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

create_external_schema.sql does not properly escape project_name for BigQuery #235

Closed
MaselEOBHH opened this issue Oct 17, 2023 · 1 comment · Fixed by #242
Closed

create_external_schema.sql does not properly escape project_name for BigQuery #235

MaselEOBHH opened this issue Oct 17, 2023 · 1 comment · Fixed by #242
Labels
bug Something isn't working
Milestone

Comments

@MaselEOBHH
Copy link

Describe the bug

When using dbt-external-tables with BigQuery and Project-Names containing numbers and apparently end with a number, references to that project-name must be quoted with backticks.

Steps to reproduce

Use the package together with Google-Project-Names ending with a number and an error:
Syntax error: Missing whitespace between literal and alias at [4:50]
is returned

Expected results

No error... but a newly created or existing schema

Actual results

Script stops with an error
Syntax error: Missing whitespace between literal and alias at [4:50]

Screenshots and log output

The output of dbt --version:

Running with dbt=1.3.7

The operating system you're using:
Windows / Linux

The output of python --version:
3.10.9

Additional context

macros/plugins/bigquery/create_external_schema.sql
{% set schema_exists_query %} select * from {{ source_node.database }}.INFORMATION_SCHEMA.SCHEMATA where schema_name = '{{ source_node.schema }}' limit 1 {% endset %}
should be
{% set schema_exists_query %} select * from `{{ source_node.database }}`.INFORMATION_SCHEMA.SCHEMATA where schema_name = '{{ source_node.schema }}' limit 1 {% endset %}

@thomas-vl
Copy link
Contributor

@MaselEOBHH I'm sorry for the late reaction, my colleague just notified me of this issue. I created a PR with the fix.

@jeremyyeo jeremyyeo removed the triage label Jan 18, 2024
@dataders dataders added this to the 0.9.0 milestone Apr 12, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants