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

[Bug] Hooks with this variable in properties yaml not resolving while using custom seed-path #10602

Closed
2 tasks done
crystalro0 opened this issue Aug 23, 2024 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@crystalro0
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

User has the following seed-path set up: seed-paths: ['data'] with the following in their seed properties.yml file:

version: 2

seeds:
  - name: seed2
    config:
      column_types:
        test: varchar(256)
      post-hook: "alter table {{ this }} set tag test = 'Test Identity'"

When they build the seed, the post-hook ends up with an error:

22:53:15 On seed.jaffle_shop.seed2: /* {"app": "dbt", "dbt_version": "2024.8.232", "profile_name": "user", "target_name": "default", "node_id": "seed.jaffle_shop.seed2"} */
alter table  set tag test = 'Test Identity'
22:53:15 Snowflake adapter: Snowflake query id: 
22:53:15 Snowflake adapter: Snowflake error: 001003 (42000): SQL compilation error:
syntax error line 1 at position 13 unexpected 'set'.
22:53:15 Database Error in seed seed2 (data/seed2.csv)
  001003 (42000): e: SQL compilation error:
  syntax error line 1 at position 13 unexpected 'set'.
  compiled Code at target/run/jaffle_shop/data/seed2.csv`

Expected Behavior

this should be resolved to demo.dbt_myuser.seed2

22:55:36 On seed.jaffle_shop.seed2: /* {"app": "dbt", "dbt_version": "2024.8.232", "profile_name": "user", "target_name": "default", "node_id": "seed.jaffle_shop.seed2"} */
alter table demo.dbt_myuser.seed2 set tag test = 'Test Identity'

Steps To Reproduce

  1. Using versionless and Snowflake
  2. Create a simple seed with one column named 'test'.
  3. Create _properties.yml file with the above configuration.
  4. Run dbt build --select seed2

Relevant log output

No response

Environment

- OS:
- Python:
- dbt: 1.8.x

Which database adapter are you using with dbt?

snowflake

Additional Context

One workaround may be to put the seeds that need the post-hook in a subfolder within the seed-path and add the config in dbt_project like the below:

seeds:
  your_project_name:
    subfolder:
      +post-hook: "alter table {{ this }} set tag test = 'Test Identity'"
@crystalro0 crystalro0 added bug Something isn't working triage labels Aug 23, 2024
@dbeatty10
Copy link
Contributor

Thank you for reporting this @crystalro0 🤩

Agreed that your proposed workaround should work as long as it is the only seed within the subfolder subdirectory.

If there are multiple seeds in that subfolder, you'd need to do the following to get just the seed named seed2:

seeds:
  your_project_name:
    subfolder:
      seed2:
        +schema: seed_data

This was also reported in #7128, so I'm going to close this one as a duplicate. There's a proposed solution in #10603.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2024
@dbeatty10 dbeatty10 added duplicate This issue or pull request already exists and removed triage labels Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants