YAML selectors

YAML selectors allow you to define and manage complex asset selection criteria in a single selectors.yml file. Storing selectors improves code readability by allowing the reuse of complex asset selection statements across your Y42 space. Moreover, selectors are version-controlled using your space's Git repository, ensuring they remain synchronized with your build history.

Create and use YAML selectors

Create a selectors file

In Code Editor mode, create a new selectors.yml file in the project's root directory. This file must be place at the top-level of your Y42 project, alongside dbt_project.yml.

    • dbt_project.yml
    • selectors.yml
  • Define your selectors

    Define your selectors in the selectors.yml file with the following properties:

    • name (required)
    • description (optional)
    • definition (required) - Write all asset selection logic within this YAML key.
    selectors.yaml

    _21
    selectors:
    _21
    - name: my_selector
    _21
    description: "a reusable complex selector"
    _21
    definition:
    _21
    union:
    _21
    - intersection:
    _21
    - method: source
    _21
    value: snowplow
    _21
    childrens_parents: true
    _21
    - method: tag
    _21
    value: nightly
    _21
    - method: path
    _21
    value: models/export
    _21
    - exclude:
    _21
    - intersection:
    _21
    - method: package
    _21
    value: snowplow
    _21
    - method: config.materialized
    _21
    value: incremental
    _21
    - method: fqn
    _21
    value: export_performance_timing

    Utilize a selector

    Once you've committed the selectors.yml file to the space's Git repository, you can apply a selector using the --selector command flag.

    Terminal

    _10
    y42 build --selector my_selector