Support bigquery dialect - SQL (#5261)

# Your PR Title (What it does)

Adding an if statement to deal with bigquery sql dialect. When I use
bigquery dialect before, it failed while using SET search_path TO. So
added a condition to set dataset as the schema parameter which is
equivalent to SET search_path TO . I have tested and it works.


## Who can review?

Community members can review the PR once tests pass. Tag
maintainers/contributors who might be interested:
@dev2049
searx_updates
Hassan Ouda 12 months ago committed by GitHub
parent 2ef5579eae
commit 56ad56c812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -329,6 +329,8 @@ class SQLDatabase:
connection.exec_driver_sql(
f"ALTER SESSION SET search_path='{self._schema}'"
)
elif self.dialect == "bigquery":
connection.exec_driver_sql(f"SET @@dataset_id='{self._schema}'")
else:
connection.exec_driver_sql(f"SET search_path TO {self._schema}")
cursor = connection.execute(text(command))

Loading…
Cancel
Save