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

[CT-173] [Bug] Cannot assign meta configs to snapshotts #4693

Closed
1 task done
jelstongreen opened this issue Feb 8, 2022 · 3 comments
Closed
1 task done

[CT-173] [Bug] Cannot assign meta configs to snapshotts #4693

jelstongreen opened this issue Feb 8, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jelstongreen
Copy link

jelstongreen commented Feb 8, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We use the meta section of models/snapshots within the schema.yml to assign ownership of models:

snapshots:
  - name: a_snapshot
    meta:
      owner: '@a.user'
    description: >
        A desciption
    columns:
      - name: id
        description: Primary key
        tests:
            - unique
            - not_null

This would work fine for models but for snapshots you get the error:

Running with dbt=0.21.1
Encountered an error:
Snapshots must be configured with a 'strategy', 'unique_key', and 'target_schema'.

As you can see the error is particularly unhelpful in that it does not show which snapshots are failing.

Expected Behavior

We would expect the metadata to be assigned correctly to the snapshot and be made available in the manifest.

Steps To Reproduce

Attempt to dbt snapshot when assigning meta data to a snapshot in the schema.yml

Relevant log output

Using snapshots/schema.yml

snapshots:
  - name: a_snapshot
    meta:
      owner: '@a.user'
    description: >
        A desciption
    columns:
      - name: id
        description: Primary key
        tests:
            - unique
            - not_null

Returns:

(datalake-models) ➜  datalake-models git:(fix-snapshot) ✗ dbt snapshot
Running with dbt=0.21.1
Encountered an error:
Snapshots must be configured with a 'strategy', 'unique_key', and 'target_schema'.

Using snapshots/schema.yml

snapshots:
  - name: a_snapshot
    #meta:
    #  owner: '@a.user'
    description: >
        A desciption
    columns:
      - name: id
        description: Primary key
        tests:
            - unique
            - not_null

Returns:

(datalake-models) ➜  datalake-models git:(fix-snapshot) ✗ dbt snapshot
Running with dbt=0.21.1
WARNING: Found patch for macro "mutually_exclusive_ranges" which was not found
Found 400 models, 823 tests, 12 snapshots, 0 analyses, 435 macros, 0 operations, 26 seed files, 170 sources, 0 exposures

Environment

- OS:MacOS Monterey 12.2
- Python:3.9.10
- dbt:0.21.1

What database are you using dbt with?

other (mention it in "Additional Context")

Additional Context

Spark

@jelstongreen jelstongreen added bug Something isn't working triage labels Feb 8, 2022
@github-actions github-actions bot changed the title [Bug] Cannot assign meta configs to snapshotts [CT-173] [Bug] Cannot assign meta configs to snapshotts Feb 8, 2022
@gshank gshank self-assigned this Feb 14, 2022
@gshank
Copy link
Contributor

gshank commented Feb 14, 2022

Thanks for reporting this -- there's definitely something odd going on here. From my experiments, it looks like it might work to add a '+' in front of the meta, but I don't think that ought to be necessary. In addition, it ought to work to set meta in a 'config' key of the snapshot yaml, but that also gets the error message. In addition, there's #4459, which means that the meta shows up in the config.meta in the manifest.

This looks like a bug that needs to be fixed.

@jtcohen6
Copy link
Contributor

I believe this was resolved by #4726, which was just included (via backport) in v1.0.5

@jhannan13
Copy link

circling back on this one (I posted in slack first but then took a peek here), I just ran into some odd behaviors related to snapshots and meta tags

I’ve configured my snapshots to land in a different schema

snapshots:  
  project:
    salesforce:
      +target_schema: |
        {%- if target.name == 'prod' -%}
          salesforce
        {%- else -%}
          {{ target.schema }}
        {%- endif -%}

and I had some basic docs for my snapshot

version: 2

snapshots:
  - name: snapshot_salesforce__opportunities
    description: daily snapshot of salesforce opportunities, capturing changing dimensions
      over time
    columns:
      - name: opportunity_amount
        meta:
          sigma_col_format: currency
    meta:
      sigma_badge: endorsed

the introduction of the meta tags was forcing my snapshot to land in the target.schema and not salesforce in prod like I had hoped—after removing the tags I had the behavior I expected. not sure if this is quite worth another bug report yet or not, just wanted to surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants