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] Fix scenarios where --empty flag pushes limit 0 into metadata queries #257

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

mikealfare
Copy link
Contributor

resolves #213

Problem

We fixed dbt-snowflake when using --empty and running metadata queries.

Solution

Add the tests for that fix so other adapters can use it if necessary.

Implementation

  1. Merge this PR demonstrating that these tests work
  2. Move the bulk of this PR into dbt-tests-adapter (we`re here)
  3. Create a final PR that removes most of this and uses the dbt-tests-adapter tests

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development, and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Jul 2, 2024
@mikealfare mikealfare requested a review from a team as a code owner July 2, 2024 19:54
@cla-bot cla-bot bot added the cla:yes The PR author has signed the CLA label Jul 2, 2024
@mikealfare mikealfare changed the title Bug/213 fix empty flag [Bug] Fix scenarios where --empty flag pushes limit 0 into metadata queries Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@mikealfare mikealfare changed the title [Bug] Fix scenarios where --empty flag pushes limit 0 into metadata queries [Bug] Fix scenarios where --empty flag pushes limit 0 into metadata queries Jul 2, 2024
@mikealfare
Copy link
Contributor Author

Do we need to update this one too? https://github.com/dbt-labs/dbt-adapters/blob/bug/213-fix-empty-flag/dbt/include/global_project/macros/materializations/tests/where_subquery.sql#L9

I'm honestly not sure. Based on where this macro is, I assume it's used in the test materialization. However, I don't see where this macro is called. I looked in both dbt-adapters and dbt-snowflake and there's no reference outside of defining the macro. Either way, I think we'd want to limit the results here just like we would in other materializations. It also doesn't create invalid sql like it does in describe/show queries. I can add it if you feel otherwise, but I'm inclined to leave this as is.

@mikealfare mikealfare merged commit 99e8194 into main Jul 3, 2024
15 checks passed
@mikealfare mikealfare deleted the bug/213-fix-empty-flag branch July 3, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes The PR author has signed the CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] --empty flag generates invalid SQL when running adapter.get_columns_in_relation
2 participants