dbtfishtown-analytics

DBT error unrecognized arguments when passing --vars on Windows


My DBT project is highly dependent on receiving variables at runtime. When I pass these variables using the below command I get an error from DBT. The command complies 100% with the documentation . I have no idea why DBT will reject this command

dbt parse --profiles-dir . --target dev --vars '{"client_name": "ecc6_test_client","fiscal_start_month_number": "3","fiscal_year": "2020"}'

Here is the error:

...
dbt: error: unrecognized arguments: ecc6_test_client,fiscal_start_month_number: 3,fiscal_year: 2020}'

These variables are also defined in my dbt_project.yml, but I need to override them at runtime

vars:
  # Client name
  client_name: "ecc6_test_client_1"
  # Fiscal period start month as number
  fiscal_start_month_number: "1"
  # Fiscal year
  fiscal_year: "2000"
  # Source Schema
  source_schema: "ecc6_test_client_1_2000"

When I run dbt without the --vars it executes without any issue


Solution

  • Solution mentioned in https://github.com/dbt-labs/docs.getdbt.com/issues/620

    Change the quotes, add the dictionary string within double quotes

    dbt parse --profiles-dir . --target dev --vars "{client_name: ecc6_test_client,fiscal_start_month_number: 3,fiscal_year: 2020}"