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

Missing identifier quoting #144

Closed
apisarenco opened this issue Mar 21, 2023 · 0 comments · Fixed by #217
Closed

Missing identifier quoting #144

apisarenco opened this issue Mar 21, 2023 · 0 comments · Fixed by #217
Labels
bug Something isn't working

Comments

@apisarenco
Copy link

Describe the bug

Identifiers are not quoted even when the setting is on

Steps to reproduce

  1. Have as source databases that contain non-alphanumeric characters (ex. UUID as database name)
  2. Have queries that source from those tables
  3. Compile the model and behold! not quoted strings.

Expected behaviour

Database names and table names should be quoted when configured

Code examples, such as models or profile settings

version: 2

sources:
  - name: t01
    schema: "a6bf4b3f-17ee-4ae3-b769-acc2ffe0d708"
    tables: &tables
      - name: the_table
      - name: the_other_table
    quoting: &quoting
      database: true
      schema: true
      identifier: true

  - name: t02
    schema: "6410659e-85c7-413b-b952-aca7fd639788"
    tables: *tables
    quoting: *quoting
{{
    config({
        "materialized": "table",
        "engine": "MergeTree()",
        "schema": "dev",
        "order_by": '(id)'
    })
}}
{% set tenants =  ['t01', 't02'] %}
{% set data_sources = [] %}
{% for tenant in tenants %}
{% do data_sources.append(source(tenant, 'the_table')) %}
{% endfor %}
WITH cte AS (
    {{ dbt_utils.union_relations(data_sources) }}
)
SELECT * FROM cte
@apisarenco apisarenco added the bug Something isn't working label Mar 21, 2023
@genzgd genzgd mentioned this issue Dec 5, 2023
2 tasks
@genzgd genzgd linked a pull request Dec 5, 2023 that will close this issue
2 tasks
This issue was closed.
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.

1 participant