You are viewing an outdated version of the documentation.

This documentation is for an older version (1.4.7) of Dagster. You can view the version of this page from our latest release below.

Asset Selection Syntax#

To specify an asset selection as a string, Dagster supports a simple query syntax. This selection syntax is accepted in a few different places:

  • The list and materialize commands in the asset command-line interface.
  • The asset filter text box on the asset graph page, in the UI.
  • The 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:

  • A query includes a list of clauses. Clauses are separated by commas, except in the case of the selection parameter of define_asset_job, materialize, and materialize_to_memory, where each clause is a separate element in a list.
  • A clause can be an asset key, in which case that asset is selected.
  • An asset key with multiple components can be specified by inserting slashes between the components.
  • A clause can be an asset key preceded by *, in which case that asset and all of its ancestors (upstream dependencies) are selected.
  • A clause can be an asset key followed by *, in which case that asset and all of its descendents (downstream dependencies) are selected.
  • A clause can be an asset key followed by any number of +s, in which case that asset and descendents up to that many hops away are selected.
  • A clause can be an asset key preceded by any number of +s, in which case that asset and ancestors up to that many hops away are selected.

Clause examples

  • some_asset: select "some_asset" itself
  • my/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.