Skip to content

Commit

Permalink
Merge pull request #116 from bruin-data/patch/use-project-id-for-bq-dest
Browse files Browse the repository at this point in the history
use project id for bigquery destination:
  • Loading branch information
karakanb authored Feb 7, 2025
2 parents 796f4f2 + 602eace commit 2570920
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ingestr/src/destinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ def dlt_dest(self, uri: str, **kwargs):
base64.b64decode(credentials_base64[0]).decode("utf-8")
)

project_id = None
if source_fields.hostname:
project_id = source_fields.hostname

return dlt.destinations.bigquery(
credentials=credentials, # type: ignore
location=location,
project_id=project_id,
**kwargs,
)

Expand Down
2 changes: 1 addition & 1 deletion ingestr/src/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"oracle+cx_oracle",
"hana",
"clickhouse",

]


class SourceProtocol(Protocol):
def dlt_source(self, uri: str, table: str, **kwargs):
pass
Expand Down
4 changes: 2 additions & 2 deletions ingestr/src/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def dlt_source(self, uri: str, table: str, **kwargs):

if uri.startswith("mysql://"):
uri = uri.replace("mysql://", "mysql+pymysql://")

if uri.startswith("clickhouse://"):
uri = uri.replace("clickhouse://", "clickhouse+native://")
if "secure=" not in uri:
uri += "?secure=1"
uri += "?secure=1"

query_adapters = []
if kwargs.get("sql_limit"):
Expand Down

0 comments on commit 2570920

Please sign in to comment.