Skip to content

Commit

Permalink
feat(bigquery): support to query BigQuery external table (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal authored Feb 6, 2025
1 parent 664e6af commit 83389fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ibis-server/app/model/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def query(self, sql: str, limit: int) -> pd.DataFrame:
credentials = service_account.Credentials.from_service_account_info(
credits_json
)
credentials = credentials.with_scopes(
[
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/cloud-platform",
]
)
client = bigquery.Client(credentials=credentials)
ibis_schema_mapper = ibis.backends.bigquery.BigQuerySchema()
bq_fields = client.query(sql).result()
Expand Down
6 changes: 6 additions & 0 deletions ibis-server/app/model/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def get_bigquery_connection(info: BigQueryConnectionInfo) -> BaseBackend:
credentials = service_account.Credentials.from_service_account_info(
credits_json
)
credentials = credentials.with_scopes(
[
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/cloud-platform",
]
)
return ibis.bigquery.connect(
project_id=info.project_id.get_secret_value(),
dataset_id=info.dataset_id.get_secret_value(),
Expand Down

0 comments on commit 83389fd

Please sign in to comment.