Confused with cli --vars syntax

The problem I’m having

Using the syntax for --vars as indicated in the documentation causes an error.

What I’ve already tried

this is the command I ran in the cli.

dbt ls --select Default_Mig_Date --vars '{"mig_date":"2024-01-31"}'

resulting in the error

00:56:01  The YAML provided in the --vars argument is not valid.
Usage: dbt ls [OPTIONS]
Try 'dbt ls -h' for help.

Error: Invalid value for '--vars': String ''{mig_date:2024-01-31}'' is not valid YAML

however, when I run the command by removing the first and last single quotes like the command below, no error will occur.

dbt ls --select Default_Mig_Date --vars {"mig_date":"2024-01-31"}

Try including a space after the colon

dbt ls --select Default_Mig_Date --vars '{"mig_date": "2024-01-31"}'

Hi,

thank you for responding, however, your suggestion did not work.

What worked for me is I changed the starting and ending single quotes to double quotes and changed the inner double quotes to single quotes.

dbt ls --select Default_Mig_Date --vars "{'mig_date':'2024-01-31'}"

2 Likes