File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,10 @@ def shutdown_session(exception=None):
348
348
try :
349
349
result = connection .execute ("SELECT LASTVAL()" )
350
350
ret = result .first ()[0 ]
351
+
352
+ # Commit changes to Postgres
353
+ connection .execute ("COMMIT" )
354
+
351
355
except sqlalchemy .exc .OperationalError : # If lastval is not yet defined in this session
352
356
ret = None
353
357
else :
@@ -356,6 +360,9 @@ def shutdown_session(exception=None):
356
360
# If DELETE or UPDATE, return number of rows matched
357
361
elif command in ["DELETE" , "UPDATE" ]:
358
362
ret = result .rowcount
363
+ # Commit changes to Postgres
364
+ if self ._engine .url .get_backend_name () in ["postgres" , "postgresql" ]:
365
+ connection .execute ("COMMIT" )
359
366
360
367
# If constraint violated, return None
361
368
except sqlalchemy .exc .IntegrityError as e :
You can’t perform that action at this time.
0 commit comments