Compatible with SQLAlchemy 1.4.*

Compatible with SQLAlchemy 1.4.*
This commit is contained in:
WangWeigao
2021-12-16 16:40:18 +08:00
committed by GitHub
parent 0e2d186857
commit ce3be02cce
+4 -1
View File
@@ -360,7 +360,10 @@ class Connection(object):
cursor = self._conn.execute(text(query), **params) # TODO: PARAMS GO HERE
# Row-by-row Record generator.
row_gen = (Record(cursor.keys(), row) for row in cursor)
row_gen = iter(Record([], []))
if cursor.returns_rows:
row_gen = (Record(cursor.keys(), row) for row in cursor)
# Convert psycopg2 results to RecordCollection.
results = RecordCollection(row_gen)