Skip to content

Commit

Permalink
Merge pull request #93 from dagster-io/add-row-counts
Browse files Browse the repository at this point in the history
add new fetch row_count to dbt_assets
  • Loading branch information
cnolanminich authored May 24, 2024
2 parents 44694dd + 14d75af commit de18252
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dagster-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
if: steps.prerun.outputs.result != 'skip'
run: |
pip install pip --upgrade;
pip install dagster-dbt dagster-cloud dbt-core~=1.7.0 dbt-duckdb~=1.7.5 dbt-snowflake~=1.7.3 --upgrade --upgrade-strategy eager;
pip install dagster-dbt dagster-cloud dbt-core dbt-duckdb dbt-snowflake --upgrade --upgrade-strategy eager;
make deps
dagster-dbt project prepare-for-deployment --file hooli_data_eng/project.py
dagster-cloud ci dagster-dbt project manage-state --file hooli_data_eng/project.py --source-deployment data-eng-prod
Expand Down
14 changes: 11 additions & 3 deletions hooli_data_eng/assets/dbt_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ def _process_partitioned_dbt_assets(context: OpExecutionContext, dbt: DbtCliReso

# Emits an AssetObservation for each asset materialization, which is used to
# identify the Snowflake credit consumption
yield from dbt_with_snowflake_insights(context, dbt_cli_task)
yield from dbt_with_snowflake_insights(
context=context,
dbt_cli_invocation=dbt_cli_task,
dagster_events=dbt_cli_task.stream().fetch_row_counts(),
)

# fetch run_results.json to log compiled SQL
run_results_json = dbt_cli_task.get_artifact("run_results.json")
Expand Down Expand Up @@ -163,7 +167,11 @@ def views_dbt_assets(context: OpExecutionContext, dbt2: DbtCliResource):

# Emits an AssetObservation for each asset materialization, which is used to
# identify the Snowflake credit consumption
yield from dbt_with_snowflake_insights(context, dbt_cli_task)
yield from dbt_with_snowflake_insights(
context=context,
dbt_cli_invocation=dbt_cli_task,
dagster_events=dbt_cli_task.stream().fetch_row_counts(),
)

# fetch run_results.json to log compiled SQL
run_results_json = dbt_cli_task.get_artifact("run_results.json")
Expand All @@ -190,7 +198,7 @@ def dbt_slim_ci(dbt2: DbtCliResource):
dagster_dbt_translator=CustomDagsterDbtTranslator(
DagsterDbtTranslatorSettings(enable_asset_checks=True)
),
).stream()
).stream().fetch_row_counts()


# This job will be triggered by Pull Request and should only run new or changed dbt models
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"pandas",
"numpy",
"scipy",
"dbt-core~=1.7.0",
"dbt-duckdb~=1.7.5",
"dbt-snowflake~=1.7.0",
"dbt-core",
"dbt-duckdb",
"dbt-snowflake",
"dagster-duckdb",
"dagster-aws",
"dagster-duckdb-pandas",
Expand Down

0 comments on commit de18252

Please sign in to comment.