# A variable from dbt\_project.yml is not being overriden by command line

**URL:** <https://discourse.getdbt.com/t/a-variable-from-dbt-project-yml-is-not-being-overriden-by-command-line/11201>\
**Category:** Help\
**Tags:** variables, dbt-core\
**Created:** [December 15, 2023, 3:16pm UTC](https://discourse.getdbt.com/t/a-variable-from-dbt-project-yml-is-not-being-overriden-by-command-line/11201 "2023-12-15T15:16:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![katab](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@katab](https://discourse.getdbt.com/u/katab)\
**Post date:** [December 15, 2023, 3:16pm UTC](https://discourse.getdbt.com/t/a-variable-from-dbt-project-yml-is-not-being-overriden-by-command-line/11201/1 "2023-12-15T15:16:41Z")

</div>

## The problem

I am using a macro which uses a variable to create a source name. Instead of taking the variable passed in the command line, the default variable from dbt\_project.yml is being used.

## The context of why I’m trying to do this

dbt core 1.4.9. (cannot have the newest version because of conflict with dbt-sqlserver package,run both in terminal and in PyCharm terminal with the same output

## Example code

Variable definition in dbt\_project.yml:

```auto
profile: 'myprofile'

vars:
    market: 'hu'

```

Macro looks like;

```auto
{% macro db_source_var(source_name, table_name) %}

{% set dataset_name = var('market') %}

{{ source(source_name + "_" + dataset_name, table_name)}}

{% endmacro %}

```

Exampe command:

```auto
 dbt run --target=beta --vars '{market:sk}'

```

My profile looks like:

```auto
myprofile:
  target: cz
  outputs:
    cz:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: BETA
      port: 1433
      database: XXX
      schema: cz
      windows_login: True
      trust_cert: True
      threads: 4
    sk:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: BETA
      port: 1433
      database: YYY
      schema: sk
      windows_login: True
      trust_cert: True
      threads: 4
    hu:
      type: sqlserver
      driver: 'ODBC Driver 17 for SQL Server'
      server: BETA
      port: 1433
      database: ZZZ
      schema: hu
      windows_login: True
      trust_cert: True
      threads: 4
    beta:
        type: sqlserver
        driver: 'ODBC Driver 17 for SQL Server'
        server: BETA
        port: 1433
        database: BBB
        schema: beta
        windows_login: True
        trust_cert: True
        threads: 4

```

---

<div class="post-metadata">

**Author:** ![Kdesl](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@Kdesl](https://discourse.getdbt.com/u/Kdesl)\
**Post date:** [December 15, 2023, 4:17pm UTC](https://discourse.getdbt.com/t/a-variable-from-dbt-project-yml-is-not-being-overriden-by-command-line/11201/2 "2023-12-15T16:17:38Z")

</div>

put a space after the : ‘{market: sk}’
