Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom tags #1014

Merged
merged 4 commits into from
Oct 17, 2018
Merged

Add custom tags #1014

merged 4 commits into from
Oct 17, 2018

Conversation

drewbanin
Copy link
Contributor

@drewbanin drewbanin commented Sep 19, 2018

Fixes #311

Specify tags for a model:

{{
  config(tags=['nightly'])
}}

-- OR:

{{
  config(tags='nightly')
}}

select ..

or:

models:
  snowplow:
    # Set tags as a string
    tags: bi

  my_project:
    clickstream:
      # Set tags as a list
      tags: ['nightly', 'crm']

    advertising:
      tags: ['nightly']

Select models with a tag:

$ dbt run --model tag:nightly

Select using a mix of tags, fqns, and parent/child selectors:

$ dbt run --model tag:nightly+ salesforce.*+

As a result of this PR, selectors can also explicitly use the fqn: selector type to select models by their full qualified names:

$ dbt run --model fqn:snowplow_sessions
# equivalent to:
$ dbt run --model snowplow_sessions

TODO:

  • add test for setting tags in dbt_project.yml
  • good error message when a bad selector is provided
  • support setting tags as a string

Error message when a bad selector is provided

$ dbt run --model tags:10
Found 1 operations, 179 macros, 1 analyses, 1 seed files, 3 tests, 3 models, 1 archives
The 'tags' selector specified in tags:10 is invalid. Must be one of [tag, fqn]
* Spec='tags:10' does not identify any models and was ignored

WARNING: Nothing to do. Try checking your model configs and model specification args

@drewbanin drewbanin force-pushed the feature/tags branch 2 times, most recently from 68631ae to 3e61622 Compare September 20, 2018 19:21
@abelsonlive
Copy link
Contributor

nice! very excited about this :)

@drewbanin drewbanin merged commit 84588a3 into dev/guion-bluford Oct 17, 2018
@drewbanin drewbanin deleted the feature/tags branch October 17, 2018 19:30
@drewbanin drewbanin mentioned this pull request Nov 1, 2018
6 tasks
@drewbanin drewbanin mentioned this pull request Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants