PrefectHQ / prefect

Prefect is a workflow orchestration tool empowering developers to build, observe, and react to data pipelines

Home Page:https://prefect.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prefect-dbt: from_file method for PostgresTargetConfig

robfreedy opened this issue · comments

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to find a similar request and didn't find it.
  • I searched the Prefect documentation for this feature.

Prefect Version

2.x

Describe the current behavior

Currently, you have to define a PostgresTargetConfigs block with Postgres database configurations manually in python code or in the Prefect UI, which can then get passed to the DbtCliProfile to save the credentials. This usually means a lot of copying and pasting from the dbt profiles.yml or elsewhere.

Describe the proposed behavior

Add a from_file method to the PostgresTargetConfigs block to automatically populate the credentials and config into a new instance of a PostgresTargetConfig block given an existing dbt profiles.yml file.

Example Use

postgres_target_config = PostgresTargetConfgs.from_file(file_path="/path/to/profileyaml/.dbt/profile.yml")
dbt_cli_profile = DbtCliProfile(
            name="jaffle_shop",
            target="dev",
            target_configs=postgres_target_config,
        )

Additional context

No response