Skip to content

Commit

Permalink
Merge pull request #109 from DalgoT4D/pass-full-credentials-to-dbt
Browse files Browse the repository at this point in the history
pass all payload credentials to TargetConfigs
  • Loading branch information
fatchat authored Apr 14, 2024
2 parents 8bb6e5a + e30200d commit 3519082
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions proxy/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,12 @@ async def _create_dbt_cli_profile(
raise TypeError("payload is of wrong type")
# logger.info(payload) DO NOT LOG - CONTAINS SECRETS
if payload.wtype == "postgres":
extras = payload.credentials
extras["user"] = extras["username"]
target_configs = TargetConfigs(
type="postgres",
schema=payload.profile.target_configs_schema,
extras={
"user": payload.credentials["username"],
"password": payload.credentials["password"],
"dbname": payload.credentials["database"],
"host": payload.credentials["host"],
"port": payload.credentials["port"],
},
extras=extras,
)

elif payload.wtype == "bigquery":
Expand Down Expand Up @@ -485,13 +481,10 @@ async def update_dbt_cli_profile(payload: DbtCliProfileBlockUpdate):
if payload.wtype is None:
raise TypeError("wtype is required")
if payload.wtype == "postgres":
dbtcli_block.target_configs.extras = {
"user": payload.credentials["username"],
"password": payload.credentials["password"],
"dbname": payload.credentials["database"],
"host": payload.credentials["host"],
"port": payload.credentials["port"],
}
dbtcli_block.target_configs.extras = payload.credentials
dbtcli_block.target_configs.extras["user"] = (
dbtcli_block.target_configs.extras["username"]
)

elif payload.wtype == "bigquery":
dbcredentials = GcpCredentials(service_account_info=payload.credentials)
Expand Down

0 comments on commit 3519082

Please sign in to comment.