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

Use sql instead of compiled_code within the default get_limit_sql macro #372

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dbeatty10
Copy link
Contributor

@dbeatty10 dbeatty10 commented Dec 5, 2024

resolves #370

Problem

#249 (comment)

@VersusFacit and @mikealfare Looks like this line should be using the function parameter {{ sql }}. It works with {{ compiled_code }} I assume because of the context being set in the get_show_sql macro, but that's likely hiding a future bug.

I could be wrong, but ran into this when providing a custom version of get_show_sql in my project.

Solution

Just swap out sql for compiled_code.

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
  • 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.)

@cla-bot cla-bot bot added the cla:yes label Dec 5, 2024
@dbeatty10 dbeatty10 changed the title Use sql instead of compiled_code within the default `get_limit_sq… Use sql instead of compiled_code within the default get_limit_sql macro Dec 5, 2024
@dbeatty10 dbeatty10 marked this pull request as ready for review December 5, 2024 21:18
@dbeatty10 dbeatty10 requested a review from a team as a code owner December 5, 2024 21:18
@VersusFacit
Copy link
Contributor

Interesting code change 🤔

Before we merge something like this, can we get some downstream CI builds from concrete adapters that show this is correct? Adapters itself doesn't have the functional tests to give us confidence

@dbeatty10
Copy link
Contributor Author

@VersusFacit Assuming something like this will do the trick?

@dbeatty10
Copy link
Contributor Author

@VersusFacit Assuming something like this will do the trick?

Assuming so, opened this draft PR to run tests against this branch: dbt-labs/dbt-postgres#178

Does something similar need to be done on adapters other than dbt-postgres? Or is this sufficient?

@dbeatty10
Copy link
Contributor Author

@VersusFacit all checks on dbt-postgres passed on dbt-labs/dbt-postgres#178 -- see below for screenshot.

Does something similar need to be done on adapters other than dbt-postgres? Or is this sufficient?

image

@amychen1776
Copy link
Contributor

@dbeatty10 are you able to test this out on other adapters too? That would give me more confidence

@dbeatty10
Copy link
Contributor Author

dbeatty10 commented Dec 11, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] compiled_code instead of sql within default__get_limit_sql macro
3 participants