Skip to content
Snippets Groups Projects

Ensure django database wrappers always have a connection before creating a cursor

Merged Bastien Abadie requested to merge ensure-db-connection into master
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -54,7 +54,7 @@ def run_pg_query(query, source_db):
db = connections[source_db]
# Make sure a connection is open and available for export databases
if db != "default" and db.connection is None:
if source_db != "default" and db.connection is None:
db.connect()
with db.create_cursor(name=str(uuid.uuid4())) as pg_cursor:
Loading