-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
What's the issue?
Node selection method path doesn't return any assets when using a YML selector passed in via the dbt_selector argument of build_dbt_asset_selection. These selectors function as expected when using the dbt CLI locally or appending the selector directly to the dbt.cli command string.
What did you expect to happen?
I expected a dbt selector with method: path, value: "*" to return the same set of assets as method: fqn, value: "*", since these selectors return the same asset set when using the dbt CLI.
How to reproduce?
Here's the selectors that I'm using:
selectors:
- name: select-with-fqn
default: false
definition:
method: fqn
value: "*"
- name: select-with-path
default: false
definition:
method: path
value: "*"And here's a test that uses each selector:
def test_with_selector():
test_selection_fqn = build_dbt_asset_selection(
dbt_assets=[my_dbt_assets],
dbt_selector="select-with-fqn",
)
## fqn selector
selected_assets_fqn = {
asset_key.to_user_string()
for asset_key in test_selection_fqn.resolve([my_dbt_assets])
}
fqn_count = len(selected_assets_fqn)
assert fqn_count > 0 # passes
## path selector
test_selection_path = build_dbt_asset_selection(
dbt_assets=[my_dbt_assets],
dbt_selector="select-with-path",
)
selected_assets_path = {
asset_key.to_user_string()
for asset_key in test_selection_path.resolve([my_dbt_assets])
}
path_count = len(selected_assets_path)
assert path_count > 0 # failsFor reference, both selectors work on the command line:
dbt ls --selector select-with-fqn
dbt ls --selector select-with-path
The selectors also work when passed in to the DbtCliResource.cli method:
def dbt_commands_example(dbt: DbtCliResource):
dbt_commands = [
"ls",
"--selector",
"select-with-path",
]
dbt.cli(dbt_commands)
Dagster version
1.11.16
Deployment type
Local
Deployment details
Local deployment / dagster dev
Additional information
dbt-core 1.10.13
dagster-dbt 0.27.16
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.