https://prefect.io logo
Title
m

Mark

10/10/2022, 1:28 PM
I am new to prefect but i was going to try and use it to test run my DBT commands. I have DBT setup in a folder locally with a profiles.yml and a project dir however, I cant seem to get the flow to find it.
from prefect import flow

from prefect_dbt.cli.credentials import DbtCliProfile
from prefect_dbt.cli.commands import trigger_dbt_cli_command

@flow
def trigger_dbt_cli_commands_flow():
    dbt_cli_profile = DbtCliProfile.load("dbtbase")

    trigger_kwargs = dict(
        profiles_dir="../dbt/data-dbt",
        project_dir="../dbt/data-dbt/dbt-project/",
        overwrite_profiles=False,
        dbt_cli_profile=dbt_cli_profile,
    )

    trigger_dbt_cli_command(
        "dbt deps",
        **trigger_kwargs
    )
    return result

trigger_dbt_cli_commands_flow()
1
which give me the following error - Unable to find block document named dbtbase for block type dbt-cli-profile
j

José Duarte

10/10/2022, 2:41 PM
are you sure your profiles file is available as a block?
m

Mark

10/10/2022, 2:49 PM
it would appear not, i was a bit confused by that. However I also am not sure how to make it a block. I tried converting my local profiles.yml to a json file and using that in the ui but that im guessing is not correct either
Are there any examples? Ideally I would like to just use my local profile file
j

José Duarte

10/10/2022, 2:51 PM
I didn’t use any blocks, you can pass the profile dir as an arg:
profiles_dir=config.DBT_PROFILES_DIR_PATH,
Oh you have it on your example and all
m

Mark

10/10/2022, 2:53 PM
ah maybe it got confused and i dont need the dbt_cli_profile = DbtCliProfile.load("dbtbase") bit
j

José Duarte

10/10/2022, 2:53 PM
probably
m

Mark

10/10/2022, 2:54 PM
yup that was it, now just to work out how to clone a private github repo
j

José Duarte

10/10/2022, 2:55 PM
about that repo: you can create an ssh key and move it to your deployment, then run a shell task to clone it
🙌 1
j

Jeff Hale

10/10/2022, 3:01 PM
Reading from a private GitHub repo is about to be more convenient. You can track the PR here.
🙌 1