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

Unable to override database name #33

Closed
1 of 5 tasks
niclas-roos opened this issue Sep 16, 2020 · 3 comments · Fixed by dbt-labs/dbt-utils#279 or #34
Closed
1 of 5 tasks

Unable to override database name #33

niclas-roos opened this issue Sep 16, 2020 · 3 comments · Fixed by dbt-labs/dbt-utils#279 or #34
Labels
bug Something isn't working

Comments

@niclas-roos
Copy link

Describe the bug

I'm trying to use generate_source in dbt cloud, running it in the prompt, to generate_source for my raw database in Snowflake, but it seems to be overridden by the default target database, analytics.

Steps to reproduce

I'm running the following script in the prompt:
dbt run-operation generate_source --args '{schema_name: BINGADS, database_name: raw}'

I've installed packages using dbt deps

Expected results

version: 2

sources:
  - name: bingads
    database: raw
    tables:
      - name: account_history
      - name: account_impression_performance_daily_report
      - name: etc

Actual results

version: 2

sources:
  - name: bingads
    database: raw
    tables:

Screenshots and log output

Log output:
On macro_generate_source: /* {"app": "dbt", "dbt_version": "0.18.0", "profile_name": "user", "target_name": "default", "connection_name": "macro_generate_source"} */

Part of log output showing the compiled SQL:

select distinct
    table_schema as "table_schema", table_name as "table_name"
from ANALYTICS.information_schema.tables
where table_schema ilike 'BINGADS'
and table_name ilike '%'
and table_name not ilike ''

System information

The contents of your packages.yml file:

packages:
  - package: fishtown-analytics/dbt_utils
    version: 0.6.1
  - package: fishtown-analytics/codegen
    version: 0.3.0

Which database are you using dbt with?

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

The output of dbt --version:

"dbt_version": "0.18.0"

The operating system you're using:

The output of python --version:

Additional context

Are you interested in contributing the fix?

@clrcrl
Copy link
Contributor

clrcrl commented Sep 16, 2020

:oof:, this is indeed a regression.

I checked it out, and it turns out the issue is in utils — fix is here

@niclas-roos
Copy link
Author

Woohoo, my first bug!

Thanks for the fix! Should I close this?

@clrcrl
Copy link
Contributor

clrcrl commented Sep 16, 2020

When we merge that PR, this issue will magically close itself :)

Also — first bug? This was an incredibly useful report, I assumed you had done this plenty of times!

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
2 participants