Search code examples
dbt

DBT: Package names must be unique in a project. Please rename one of these packages


I get the following error while running the command

dbt run

dbt found more than one package with the name "my_project_name" included in this project. Package names must be unique in a project. Please rename one of these packages.

I've used the same "my_project_name" in profiles.yml and dbt_project.yml as suggested and do not have any other package.

How can I check where this error is coming from? Any particular parameter that needs to be cross verified?

Thanks in advance!

Update:

profiles.yml

my_project_name:
  outputs:

    dev:
      type: postgres
      threads: 4
      host: hostname
      port: 5432
      user: username
      pass: password
      dbname: db
      schema: schemaname

    prod:
      type: postgres
      threads: [1 or more]
      host: [host]
      port: [port]
      user: [prod_username]
      pass: [prod_password]
      dbname: [dbname]
      schema: [prod_schema]

  target: dev
dbt_project.yml

config-version: 2
name: my_project_name
version: 1.0

profile: my_project_name

macro-paths: ["macros"]

Solution

  • I had similar issues. To resolve that, in your dbt_project.yml

    Change the name and use the same name in the models sections

    name: 'airscholar_dbt_bigquery' # this was previously dbt_bigquery
    version: '1.0.0'
    config-version: 2
    
    profile: 'dbt_bigquery'
    
    model-paths: ["models"]
    analysis-paths: ["analyses"]
    test-paths: ["tests"]
    seed-paths: ["seeds"]
    macro-paths: ["macros"]
    snapshot-paths: ["snapshots"]
    
    clean-targets: 
      - "target"
      - "dbt_packages"
    
    
    models:
      airscholar_dbt_bigquery: # also previously dbt_bigquery
        example:
          +materialized: view
    
    

    You can then run dbt run. You should be good afterwards.