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

DBT doesn't want to replace an external table #188

Closed BenoitLF closed 1 year ago

BenoitLF commented 1 year ago

Describe the bug

Dbt doesn't want to replace an external table database and schema are obfuscated but they have the exact same value between "Searched for" and "Found"

Actual results

16:57:57  Running with dbt=1.4.1
16:57:57  1 of 1 START external source "schema"."table_name"
16:57:58  Encountered an error while running operation: Compilation Error
  When searching for a relation, dbt found an approximate match. Instead of guessing
  which relation to use, dbt will move on. Please delete "database"."schema"."table_name", or rename it to be less ambiguous.
  Searched for: "database"."schema"."table_name"
  Found: "database"."schema"."table_name"

  > in macro snowflake__get_external_build_plan (macros/plugins/snowflake/get_external_build_plan.sql)
  > called by macro get_external_build_plan (macros/common/get_external_build_plan.sql)
  > called by macro stage_external_sources (macros/common/stage_external_sources.sql)
  > called by <Unknown>

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_external_tables
    version: 0.8.2

Which database are you using dbt with?

The output of dbt --version: Core:

Plugins:

The operating system you're using: : linux

The output of python --version: Python 3.8.16

jeremyyeo commented 1 year ago

Hey @BenoitLF - typically this happens when there's a table that closely resemble the target table... for example - dbt resolves to db.schema.table_name but in your Snowflake, there exist a table like db.schema.Table_Name (notice the casing here).

Can you confirm the casing of the existing table in Snowflake plus your exact source yaml file where you're trying to use this package on? :)

BenoitLF commented 1 year ago

Hello @jeremyyeo Yes I can confirm it. In fact it happens when I run the command twice, with no manual input nor modifications

BenoitLF commented 1 year ago

Maybe I have informations regarding that matter @jeremyyeo . I tried with a different schema name, test , and now it works. Before that it was 1_RAW, meaning that I had to in fact "\"1_RAW\""to make it work

github-actions[bot] commented 1 year ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

github-actions[bot] commented 1 year ago

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.