Using a simple query syntax, you can specify an asset selection as a string. In this guide, we'll cover where the syntax is supported, how it works, and some examples.
In the selection parameter of define_asset_job. Alternatively, this parameter accepts an AssetSelection object, which supports more complex selections built from compositions of Python objects. For example:
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.
Clause syntax
Description
ASSET_KEY
Selects a single asset by asset key
COMPONENT/COMPONENT
Selects an asset key with multiple components, such as a prefix, where slashes (/) are inserted between components. For example, to select an asset with an AssetKey in Python of AssetKey(["manhattan", "manhattan_stats"]), the query would be manhattan/manhattan_stats
*ASSET_KEY
An asterisk (*) preceding an asset key selects an asset and all of its upstream dependencies
ASSET_KEY*
An asterisk (*) following an asset key selects an asset and all of its downstream dependencies
+ASSET_KEY
A plus sign (+) preceding an asset key selects an asset and one layer upstream of the asset.
Including multiple +s will select that number of upstream layers from the asset. For example, ++ASSET_KEY will select the asset and two upstream layers of dependencies. Any number of +s is supported.
ASSET_KEY+
A plus sign (+) following an asset key selects an asset and one layer downstream of the asset.
Including multiple +s will select that number of downstream layers from the asset. For example, ASSET_KEY++ will select the asset and two downstream layers of dependencies. Any number of +s is supported.