Update to add SQL Server support.

This commit is contained in:
lwark
2024-11-01 13:16:16 -05:00
parent ba1b3e5cf3
commit 816a0a45f8
13 changed files with 182 additions and 67 deletions

View File

@@ -18,8 +18,18 @@ def set_sqlite_pragma(dbapi_connection, connection_record):
connection_record (_type_): _description_
"""
cursor = dbapi_connection.cursor()
# print(ctx.database_schema)
if ctx.database_schema == "sqlite":
cursor.execute("PRAGMA foreign_keys=ON")
execution_phrase = "PRAGMA foreign_keys=ON"
# cursor.execute(execution_phrase)
elif ctx.database_schema == "mssql+pyodbc":
execution_phrase = "SET IDENTITY_INSERT dbo._wastewater ON;"
else:
print("Nothing to execute, returning")
cursor.close()
return
print(f"Executing {execution_phrase} in sql.")
cursor.execute(execution_phrase)
cursor.close()