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

fix #7413: inject sql header in query for show #7568

Merged
merged 1 commit into from
May 9, 2023
Merged

fix #7413: inject sql header in query for show #7568

merged 1 commit into from
May 9, 2023

Conversation

aranke
Copy link
Member

@aranke aranke commented May 9, 2023

resolves #7413

Description

Checklist

@aranke aranke requested a review from a team May 9, 2023 17:29
@aranke aranke requested review from a team as code owners May 9, 2023 17:29
@aranke aranke requested review from iknox-fa, emmyoop and VersusFacit and removed request for a team May 9, 2023 17:29
@cla-bot cla-bot bot added the cla:yes label May 9, 2023
@aranke aranke requested review from stu-k and removed request for emmyoop and VersusFacit May 9, 2023 17:30
@@ -23,6 +23,11 @@ def execute(self, compiled_node, manifest):
# Allow passing in -1 (or any negative number) to get all rows
limit = None if self.config.args.limit < 0 else self.config.args.limit

if "sql_header" in compiled_node.unrendered_config:
compiled_node.compiled_code = (
compiled_node.unrendered_config["sql_header"] + compiled_node.compiled_code
Copy link
Contributor

@iknox-fa iknox-fa May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost certainly a premature optimization, but it's worth pointing out that string concatenation with the + operator is a bit inefficient.

ERm.. if those are strings. I assume they are at this point in the compilation process.

Copy link
Contributor

@iknox-fa iknox-fa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aranke aranke merged commit 272beb2 into main May 9, 2023
@aranke aranke deleted the fix_7413 branch May 9, 2023 18:29
@aranke aranke mentioned this pull request May 9, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2440] dbt show throws Database Error for models with sql_header required for valid query
3 participants