Skip to content

Commit 3b85f96

Browse files
committed
refactor column() method
1 parent 7d547f7 commit 3b85f96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

simple_query_builder/querybuilder.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ def go(self) -> Union[int, None]:
208208
self.query(self._sql, self._params, self._NO_FETCH)
209209
return self._cur.lastrowid
210210

211-
def column(self, column: int = 0) -> Union[tuple, list, dict, None]:
211+
def column(self, column: Union[str, int] = 0):
212+
if (self._result_dict and isinstance(column, int)) or (not self._result_dict and isinstance(column, str)):
213+
self.set_error(f"Incorrect type of column in {inspect.stack()[0][3]} method. Result dict is {self._result_dict}")
214+
return self
215+
212216
self.query("", (), self._FETCH_COLUMN, column)
213217
return self._result
214218

0 commit comments

Comments
 (0)