dbt-labs / dbt-external-tables

dbt macros to stage external sources
https://hub.getdbt.com/dbt-labs/dbt_external_tables/latest/
Apache License 2.0
294 stars 119 forks source link

create schema statements are not fully indexed for databases #195

Closed epapineau closed 1 year ago

epapineau commented 1 year ago

Describe the bug

167 added a create schema if not exists clause, but only defines the schema and not the database. If your external table is sourced out of a different database than your dbt profile, this causes an empty schema to be created in your dbt profile database.

Steps to reproduce

Define an external table with a database != dbt profile database. In our case, these are raw and analytics, respectively.

Expected results

Creating the schema in the source database

Actual results

Creating the schema in the dbt profile database

Screenshots and log output

Screenshot 2023-04-12 at 2 00 11 PM Screenshot 2023-04-12 at 2 00 20 PM

System information

The contents of your packages.yml file:

Which database are you using dbt with?

The output of dbt --version:

1.3.0

The operating system you're using: Ventura 13.3.1 The output of python --version:

3.10.7

Additional context