To specify an asset selection as a string, Dagster supports a simple query syntax. This selection syntax is accepted in a few different places:
list and materialize commands in the asset command-line interface.selection parameter of define_asset_job. (This parameter alternatively accepts an AssetSelection object, which supports more complex selections built from compositions of Python objects.)It works as follows:
selection parameter of define_asset_job, materialize, and materialize_to_memory, where each clause is a separate element in a list.*, in which case that asset and all of its ancestors (upstream dependencies) are selected.*, in which case that asset and all of its descendents (downstream dependencies) are selected.+s, in which case that asset and descendents up to that many hops away are selected.+s, in which case that asset and ancestors up to that many hops away are selected.Clause examples
some_asset: select "some_asset" itselfmy/prefixed/asset: select the asset whose AssetKey in Python is AssetKey(["my", "prefixed", "asset"])*some_asset: select "some_asset" and all ancestors (upstream dependencies).some_asset*: select "some_asset" and all descendants (downstream dependencies).*some_asset*: select "some_asset" and all of its ancestors and descendants.+some_asset: select "some_asset" and its direct parents.some_asset+++: select "some_asset" and its children, its children's children, and its children's children's children.