Skip to content

Commit 72183e8

Browse files
committed
add result_dict parameter into __init__() method
1 parent 61e03a1 commit 72183e8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

simple_query_builder/querybuilder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def __init__(self, database: DataBase, db_name: str = "", result_dict: bool = Tr
7474
self._conn = database.connect(db_name)
7575
self._print_errors = print_errors
7676
# self._conn.row_factory = sqlite3.Row
77-
self._conn.row_factory = lambda c, r: dict(
78-
[(col[0], r[idx]) for idx, col in enumerate(c.description)]
79-
)
77+
if result_dict:
78+
self._conn.row_factory = lambda c, r: dict(
79+
[(col[0], r[idx]) for idx, col in enumerate(c.description)]
80+
)
8081
self._cur = self._conn.cursor()
8182

8283
def query(self, sql: str = "", params=(), fetch=2, column=0):

0 commit comments

Comments
 (0)