-
Notifications
You must be signed in to change notification settings - Fork 121
fix: filter dbt models to upload only current project #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
260055f
902de0e
b6d7699
07776f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- macro upload_dbt_models(should_commit=false, metadata_hashes=none) -%} | ||
| {% set relation = elementary.get_elementary_relation('dbt_models') %} | ||
| {% if execute and relation %} | ||
| {% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model') %} | ||
| {% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model' ) | selectattr('package_name', '==', project_name) %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make project scoping opt‑in (behavior change). Line 4 excludes models from packages/dependencies. This is a behavioral change and should be gated behind a config/flag with a default that keeps current behavior. You can use the existing 💡 Suggested pattern (apply across all upload macros)-{% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model' ) | selectattr('package_name', '==', project_name) %}
+{% set models = graph.nodes.values() | selectattr('resource_type', '==', 'model') %}
+{% if elementary.get_config_var('limit_artifacts_to_current_project') %}
+ {% set models = models | selectattr('package_name', '==', project_name) %}
+{% endif %}🤖 Prompt for AI Agents |
||
| {% do elementary.upload_artifacts_to_table(relation, models, elementary.flatten_model, should_commit=should_commit, metadata_hashes=metadata_hashes) %} | ||
| {%- endif -%} | ||
| {{- return('') -}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- macro upload_dbt_seeds(should_commit=false, metadata_hashes=none) -%} | ||
| {% set relation = elementary.get_elementary_relation('dbt_seeds') %} | ||
| {% if execute and relation %} | ||
| {% set seeds = graph.nodes.values() | selectattr('resource_type', '==', 'seed') %} | ||
| {% set seeds = graph.nodes.values() | selectattr('resource_type', '==', 'seed') | selectattr('package_name', '==', project_name) %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make project scoping opt‑in (behavior change). Line 4 now excludes package seeds; this is a behavioral change. Please guard it behind an explicit flag (default off to preserve current behavior), matching the requested PR approach. 🤖 Prompt for AI Agents |
||
| {% do elementary.upload_artifacts_to_table(relation, seeds, elementary.flatten_seed, should_commit=should_commit, metadata_hashes=metadata_hashes) %} | ||
| {%- endif -%} | ||
| {{- return('') -}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- macro upload_dbt_snapshots(should_commit=false, metadata_hashes=none) -%} | ||
| {% set relation = elementary.get_elementary_relation('dbt_snapshots') %} | ||
| {% if execute and relation %} | ||
| {% set snapshots = graph.nodes.values() | selectattr('resource_type', '==', 'snapshot') %} | ||
| {% set snapshots = graph.nodes.values() | selectattr('resource_type', '==', 'snapshot') | selectattr('package_name', '==', project_name) %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make project scoping opt‑in (behavior change). Line 4 excludes package snapshots; this is a behavior change and should be guarded behind a flag with default preserving current behavior. 🤖 Prompt for AI Agents |
||
| {% do elementary.upload_artifacts_to_table(relation, snapshots, elementary.flatten_model, should_commit=should_commit, metadata_hashes=metadata_hashes) %} | ||
| {%- endif -%} | ||
| {{- return('') -}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- macro upload_dbt_sources(should_commit=false, metadata_hashes=none) -%} | ||
| {% set relation = elementary.get_elementary_relation('dbt_sources') %} | ||
| {% if execute and relation %} | ||
| {% set sources = graph.sources.values() | selectattr('resource_type', '==', 'source') %} | ||
| {% set sources = graph.sources.values() | selectattr('resource_type', '==', 'source') | selectattr('package_name', '==', project_name) %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make project scoping opt‑in (behavior change). Line 4 now excludes package sources; please gate this behind an explicit configuration flag (default off) to preserve existing behavior. 🤖 Prompt for AI Agents |
||
| {% do elementary.upload_artifacts_to_table(relation, sources, elementary.flatten_source, should_commit=should_commit, metadata_hashes=metadata_hashes) %} | ||
| {%- endif -%} | ||
| {{- return('') -}} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| {%- macro upload_dbt_tests(should_commit=false, metadata_hashes=none) -%} | ||
| {% set relation = elementary.get_elementary_relation('dbt_tests') %} | ||
| {% if execute and relation %} | ||
| {% set tests = graph.nodes.values() | selectattr('resource_type', '==', 'test') %} | ||
| {% set tests = graph.nodes.values() | selectattr('resource_type', '==', 'test') | selectattr('package_name', '==', project_name) %} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make project scoping opt‑in (behavior change). Line 4 filters out tests from packages/dependencies. That’s a behavior change; per PR discussion this should be gated by a config/flag with a default that preserves current behavior. Please add an opt‑in guard and apply consistently across all artifact uploads. 🤖 Prompt for AI Agents |
||
| {% do elementary.upload_artifacts_to_table(relation, tests, elementary.flatten_test, should_commit=should_commit, metadata_hashes=metadata_hashes) %} | ||
| {%- endif -%} | ||
| {{- return('') -}} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make project scoping opt‑in (behavior change).
Line 4 drops exposures from packages; this should be behind a config/flag (default off) to avoid changing behavior for existing users.
🤖 Prompt for AI Agents