Mansour Zayer
07/20/2022, 10:48 PMsubprocess
to run my dbt project locally (Prefect 1.2.2, Windows). I create my command (dbt run --vars '{data_processing_start_date: 2022-07-20, data_processing_end_date: 2022-07-20}' --profiles-dir ./
) like this:
command = (
f"dbt run --vars '{{"
f"data_processing_start_date: {data_processing_start_date}, "
f"data_processing_end_date: {data_processing_end_date}}}' --profiles-dir ./ "
)
The command is created correctly, but dbt gives me this error dbt: error: unrecognized arguments: 2022-07-20, data_processing_end_date: 2022-07-20}'
Seems like dbt interprets 2022-07-20
as an argument instead of the value for data_processing_start_date
variable.
Keep in mind that when I run the same command in my CLI, dbt works fine. But when it's provided to dbt through subprocess
this occurs.
This is my subprocess:
subprocess.run(
command,
check=True,
stderr=True,
stdout=True,
shell=True,
cwd="dbt",
)
Any idea what might cause this, and how to solve this? Thank youAnna Geller
Mansour Zayer
07/21/2022, 12:09 PMAnna Geller