Fixing issue with MSSQL connection (#8040)

My team recently faced an issue while using MSSQL and passing a schema
name.

We noticed that "SET search_path TO {self.schema}" is being called for
us, which is not a valid ms-sql query, and is specific to postgresql
dialect.

We were able to run it locally after this fix.


---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
pull/8209/head
Mahip Soni 1 year ago committed by GitHub
parent 76102971c0
commit 1f055775f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -383,7 +383,9 @@ class SQLDatabase:
)
elif self.dialect == "bigquery":
connection.exec_driver_sql(f"SET @@dataset_id='{self._schema}'")
else:
elif self.dialect == "mssql":
pass
else: # postgresql and compatible dialects
connection.exec_driver_sql(f"SET search_path TO {self._schema}")
cursor = connection.execute(text(command))
if cursor.returns_rows:

Loading…
Cancel
Save