DalgoT4D / prefect-proxy

GNU Affero General Public License v3.0
0 stars 7 forks source link

Ignore `schema` from `extras` #120

Closed Ishankoradia closed 2 months ago

Ishankoradia commented 2 months ago

This was faced by ylabls - https://github.com/DalgoT4D/webapp/issues/822

The problem is in _create_dbt_cli_profile in service.py. This is the diff before it was working and after it stopped working

 if payload.wtype == "postgres":
        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"],
            },
        )
 if payload.wtype == "postgres":
        extras = payload.credentials
        extras["user"] = extras["username"]
        target_configs = TargetConfigs(
            type="postgres",
            schema=payload.profile.target_configs_schema,
            extras=extras,
        )

Somewhere in prefect-dbt/cli/configs/based.py. The schema field is in extras and in the target_configs, so now prefect is confused which one to use while creating profiles.yml

Screenshot 2024-04-27 at 09 59 25

So we need to pass allow_field_overrides = True , for the new cli blocks and update the existing ones.