dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.88k stars 1.63k forks source link

[Bug] improper relation name (too many dotted names) #10051

Closed Ilsaffff closed 6 months ago

Ilsaffff commented 6 months ago

Is this a new bug in dbt-core?

Current Behavior

I'm encountering an issue with dbt & dbt-postgres. This happens during --full-refresh. It inserts the schema at the beginning and in the middle. rddm - schema rddm_dwh is the name of the database. event - table Database Error in seed event (seeds/bp/event.csv) improper relation name (too many dotted names): rddm.rddm_dwh.rddm_bp_seeds.event

Expected Behavior

Tables full-refreshed

Steps To Reproduce

  1. Create seeds or tables(views)
  2. Enter command dbt seed --full-refresh or dbt run --full-refresh

Relevant log output

No response

Environment

- OS: macOS
- Python: 3.10
- dbt: 1.7.13

Which database adapter are you using with dbt?

postgres

Additional Context

dbt_project.yml

seeds:
  dbt_vault:
    schema: seeds
    bp:
      schema: bp_seeds
    bd:
      schema: bd_seeds

profiles.yml

schema: rddm

09:51:13 1 of 3 START seed file rddm_rddm.bp_seeds.event ................................ [RUN] 09:51:13 2 of 3 START seed file rddm_rddm.seeds.federal_district ........................ [RUN] 09:51:13 3 of 3 START seed file rddm_rddm.seeds.region .................................. [RUN] 09:51:13 3 of 3 ERROR loading seed file rddm_rddm.seeds.region .......................... [ERROR in 0.05s] 09:51:13 2 of 3 ERROR loading seed file rddm_rddm.seeds.federal_district ................ [ERROR in 0.05s] 09:51:13 1 of 3 ERROR loading seed file rddm_rddm.bp_seeds.event ........................ [ERROR in 0.05s] 09:51:13
09:51:13 Finished running 3 seeds in 0 hours 0 minutes and 0.17 seconds (0.17s). 09:51:13
09:51:13 Completed with 3 errors and 0 warnings: 09:51:13
09:51:13 Database Error in seed region (seeds/region.csv) improper relation name (too many dotted names): rddm.rddm_dwh.rddm_rddm.seeds.region 09:51:13
09:51:13 Database Error in seed federal_district (seeds/federal_district.csv) improper relation name (too many dotted names): rddm.rddm_dwh.rddm_rddm.seeds.federal_district 09:51:13
09:51:13 Database Error in seed event (seeds/bp/event.csv) improper relation name (too many dotted names): rddm.rddm_dwh.rddm_rddm.bp_seeds.event

b-per commented 6 months ago

Did you customize any of the generate_xxx_name() macros, especially generate_schema_name()?

Ilsaffff commented 6 months ago

Did you customize any of the generate_xxx_name() macros, especially generate_schema_name()?

Yes! It was drop_table(), drop_table() uses in full refresh, I remove custom macros and it works Thanks @b-per!

Ilsaffff commented 6 months ago

Sorry guys, thank you for fast response! ❤️