I'm a newie in dbt + jinja, I would like to define a json var for a run of dbt through the command console.
This json is generated in python with a database schema, something like [{'name': 'Name', 'type': 'STRING', 'mode': 'NULLABLE'}...]
I tried in different ways but I couldn't get it. I.E:
$ dbt build --vars 'json: [{'name': 'Name', 'type': 'STRING', 'mode': 'NULLABLE'}...]'
In this case I got the error "while parsing a block mapping" probably because of the single quotes from JSON.
I tried to convert the single quotes to double quotes in python with json.dumps() function and execute again something like this:
$ dbt build --vars 'json: [{"name": "Name", "type": "STRING", "mode": "NULLABLE"}...]'
In this case I'm getting an error like:
The --vars argument must be a YAML dictionary, but was of type 'str'
I tried some more ways but with similar results.
I have to do this because I have an Airflow operator that generates this json in python with the database schema to validate and sends it via xcom to a Kubernetes Pod Operator that is in charge of launching the dbt build command with this var.
Thanks in advance!
https://docs.getdbt.com/docs/building-a-dbt-project/building-models/using-variables