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

Quoting of database name appears to be broken in get_tables_by_pattern_sql #900

Open
1 of 5 tasks
skion opened this issue May 28, 2024 · 3 comments · May be fixed by #899
Open
1 of 5 tasks

Quoting of database name appears to be broken in get_tables_by_pattern_sql #900

skion opened this issue May 28, 2024 · 3 comments · May be fixed by #899
Labels
bug Something isn't working

Comments

@skion
Copy link

skion commented May 28, 2024

Describe the bug

get_relations_by_prefix() appears to be broken on Postgres when the database name contains e.g. a hyphen.

Steps to reproduce

Use the following in a database of which the name contains a hyphen.

{% set relations = dbt_utils.get_relations_by_prefix('some_schema', 'prefix') %}

Expected results

19:03:39  Completed successfully

Actual results

18:55:53  Finished running 1 table model, 1 project hook in 0 hours 0 minutes and 2.15 seconds (2.15s).
18:55:53  
18:55:53  Completed with 1 error and 0 warnings:
18:55:53  
18:55:53    Database Error in model some_model (models/kpis.sql)
  syntax error at or near "-"
  LINE 19:         from foo-bar.information_schema.tables

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_utils
    version: 1.1.1
  - package: calogica/dbt_expectations
    version: 0.10.1
  - package: calogica/dbt_date
    version: 0.10.0
  - package: Snowflake-Labs/dbt_constraints
    version: [">=0.6.0", "<0.7.0"]
  - package: pvcy/dbt_privacy
    version: 0.3.1

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.8.1
  - latest:    1.8.1 - Up to date!

Plugins:
  - postgres: 1.8.1 - Up to date!

Additional context

Are you interested in contributing the fix?

PR is here: #899

@skion skion added bug Something isn't working triage labels May 28, 2024
@dbeatty10 dbeatty10 linked a pull request Jun 5, 2024 that will close this issue
8 tasks
@dbeatty10
Copy link
Contributor

Thanks for reporting this and opening a PR @skion !

@dbeatty10 dbeatty10 removed the triage label Jun 5, 2024
@skion
Copy link
Author

skion commented Jun 5, 2024

@dbeatty10 I unmarked it from draft just now...

@skion
Copy link
Author

skion commented Oct 16, 2024

Looking it mainline, this PR still seems relevant as of today @dbeatty10 ...

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.

2 participants