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] generic tests to accept arbitrary configs does not appear to be pulling in config options for certain tests #10484

Closed
2 tasks done
McKnight-42 opened this issue Jul 24, 2024 · 1 comment · Fixed by #10767
Assignees
Labels
bug Something isn't working user docs [docs.getdbt.com] Needs better documentation

Comments

@McKnight-42
Copy link
Contributor

McKnight-42 commented Jul 24, 2024

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

while trying respond to a slack conversation thread

about implementing the new general config options for data_tests

found that local testing showed that some tests types are not accepting the config object it seems

version: 2
models:
  - name: my_test_model  # Replace with your actual model name
    columns:
      - name: id
        data_tests:
          - not_null:
              config:
                snowflake_warehouse: analytics

logs test may pass but logs will not show snowflake_warehouse being set

best guess is tests that just trigger a macro without having any real additional config are for some reason now not able to pull in the general config.

Expected Behavior

all test types should be able to have config options added based on the work done around #10197

Steps To Reproduce

create various simple models to test against

schema.yml

version: 2
models:
  - name: my_test_model # Replace with your actual model name
    columns:
      - name: color
        tests:
          - accepted_values:
              values: ['blue', 'red', 'green', 'yellow']
              config:
                snowflake_warehouse: analytics

# can sub out for a not_null test to match above

 - name: my_test_model  # Replace with your actual model name
    columns:
      - name: id
        data_tests:
          - not_null:
              config:
                snowflake_warehouse: analytics
            

  - name: child_table
    description: "Child table containing records referencing the parent table"
    columns:
      - name: parent_id
        data_tests:
          - relationships:
              to: ref('parent_table')
              field: id
              config:
                snowflake_warehouse: dbt_snowflake_warehouse

models

child_table.sql
select * from {{ ref('child') }}

parent_table.sql
select * from {{ ref('parent') }}

my_test_model.sql
select * from {{ ref('seed') }}

seeds

child.csv

id,parent_id,value
1,1,Value 1
2,1,Value 2
3,2,Value 3
4,3,Value 4  # Corrected parent_id to 3 which exists in parent_table

parent.csv

id,name
1,Parent A
2,Parent B
3,Parent C

seed.csv

id,color,value
1,blue,10
2,red,20
3,green,30
4,yellow,40
5,blue,50
6,red,60
7,blue,70
8,green,80
9,yellow,90
10,blue,100

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

No response

Additional Context

No response

@FishtownBuildBot
Copy link
Collaborator

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#6274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants