Vyom Raj
08/13/2023, 3:18 AMTim Castillo
08/14/2023, 11:37 PM__init__.py
that has the Definitions
call in it.Vyom Raj
08/17/2023, 3:07 AMfrom dagster_dbt import DbtCloudClientResource
from dagster import EnvVar
dbt_cloud_instance = DbtCloudClientResource(
auth_token="random",
account_id="random",
)
from dagster_dbt import load_assets_from_dbt_cloud_job
# Use the dbt_cloud_instance resource we defined in Step 1, and the job_id from Prerequisites
dbt_cloud_assets = load_assets_from_dbt_cloud_job(
dbt_cloud=dbt_cloud_instance,
job_id=random,
)
from dagster import (
ScheduleDefinition,
define_asset_job,
AssetSelection,
Definitions,
)
# Materialize all assets
run_everything_job = define_asset_job("run_everything_job", AssetSelection.all())
# Materialize only the staging assets
run_staging_job = define_asset_job(
"run_staging_job", AssetSelection.groups("staging")
)
defs = Definitions(
# Use the dbt_cloud_assets defined in Step 2
assets=[dbt_cloud_assets],
schedules=[
ScheduleDefinition(
job=run_everything_job,
cron_schedule="@daily",
),
ScheduleDefinition(
job=run_staging_job,
cron_schedule="@hourly",
),
],
)
I created this python file and ran it and it works but does not do anything.
Like i am able to get authorization to work but how do i see these definition in dagster (not sure how to bring these in).jamie
08/22/2023, 2:24 PMdagster dev
locally? in dagster cloud?Vyom Raj
08/22/2023, 2:31 PMjamie
08/22/2023, 2:38 PMdagster dev
and then navigate to the localhost url it prints out (should be <http://127.0.0.1:3000/>
) you’ll get to the dagster UI
If you haven’t seen it yet, I recommend checking out the tutorial, specifically the section on navigating the UI . We also have a dbt tutorial, but it uses dbt core, the general concepts may still be of interest thoughVyom Raj
08/23/2023, 5:10 PMjamie
08/23/2023, 5:56 PMDefinitions
object. Depending on how you set up that Definitions object you may need to add the dbt cloud assets to it. If you find that object and share the code here i can tell you what to doVyom Raj
08/24/2023, 3:03 PMdbt_cloud_assets = load_assets_from_dbt_cloud_job(
dbt_cloud=dbt_cloud_instance,
job_id=290929,
)
i believe by object you mean dbt_cloud_assets with job_id.
What to do next after this to see it in dagster ?jamie
08/24/2023, 3:15 PMDefinitions
object somewhere in your code that you’ll want to add dbt_cloud_assets
toVyom Raj
08/24/2023, 3:15 PMfrom dagster import (
ScheduleDefinition,
define_asset_job,
AssetSelection,
Definitions,
)
# Materialize all assets
run_everything_job = define_asset_job("run_everything_job", AssetSelection.all())
# Materialize only the staging assets
run_staging_job = define_asset_job(
"run_staging_job", AssetSelection.groups("staging")
)
defs = Definitions(
# Use the dbt_cloud_assets defined in Step 2
assets=[dbt_cloud_assets],
schedules=[
ScheduleDefinition(
job=run_everything_job,
cron_schedule="@daily",
),
ScheduleDefinition(
job=run_staging_job,
cron_schedule="@hourly",
),
],
)
added it there.Vyom Raj
08/24/2023, 3:16 PMDefinitions
has
dbt_cloud_assets
now how to show these definitions in dagster?jamie
08/24/2023, 3:17 PMdagster dev
it should show them since they are in the definitions object nowVyom Raj
08/24/2023, 3:17 PMjamie
08/24/2023, 3:17 PMdagster dev -f test.py
Vyom Raj
08/24/2023, 3:20 PM