neville_samuell
01/28/2021, 2:13 PMmeltano invoke dbt where the wrapper isn't providing enough env vars:
root@1d67acfca30b:/project# meltano invoke dbt test
Running with dbt=0.16.1
Encountered an error:
Compilation Error
Env var required but not provided: 'DBT_TARGET'
after some hacking, I found that this works... but it's gross:
root@66ebf1065348:/project# DBT_TARGET=postgres PG_ADDRESS=postgres PG_PORT=5432 PG_USERNAME=... PG_PASSWORD=... PG_DATABASE=... meltano invoke dbt test
is this a bug?
#2: second, overall none of the docs or examples seem to include any examples of running dbt tests. personally I would want to have dbt test invocations running as part of every meltano schedule run or something similar... any guidance on what people are doing to ensure sql tests are baked deeply into their pipelines?douwe_maan
01/28/2021, 4:33 PMdbt snapshot in meltano elt pipelines, and I'd love to see a similar issue for dbt test so that we can start discussing what that should look like 🙂 In https://gitlab.com/meltano/meltano/-/issues/2454, we've been talking about including Great Expectations as a validator plugin, which could then run at the end of a pipeline, and it would make sense for dbt test to also fill that role, but since dbt is currently a transformer plugin, we'll have to think about how we can make it fill both roles from an architectural perspective.
All of that is to say that Meltano doesn't currently have an answer to question #2, but that I'd love to start finding a solution in a new issue!
As for #1, the problem is that in order to set the DBT_TARGET and SF_* env vars, Meltano needs to know the loader (and extractor) dbt is running in context of, which is readily available when it runs as part of a meltano elt /`meltano schedule run` pipeline: https://meltano.com/docs/integration.html#pipeline-environment-variables, but not when using meltano invoke by itself.
The cleanest way to resolve this would be to add a native way to run dbt test as part of meltano elt (as discussed above), but as a workaround, we could also let a schedule be specified on meltano invoke to set the pipeline environment: meltano invoke --schedule=foo-to-postgres dbt ... . I'd also welcome an issue to discuss that approach some more 🙂neville_samuell
01/28/2021, 5:20 PMneville_samuell
01/28/2021, 5:20 PMneville_samuell
01/28/2021, 5:24 PMneville_samuell
01/28/2021, 5:25 PMmeltano invoke dbt issue broadly; that's pretty specificdouwe_maan
01/28/2021, 5:26 PMdbt test as part of meltano elt and 2) Running meltano invoke in the context of a pipelineneville_samuell
01/28/2021, 5:26 PMdouwe_maan
01/28/2021, 5:26 PMneville_samuell
01/28/2021, 5:26 PMneville_samuell
01/28/2021, 5:27 PMdouwe_maan
01/28/2021, 5:27 PMneville_samuell
01/28/2021, 5:28 PMneville_samuell
01/28/2021, 5:28 PMneville_samuell
01/28/2021, 11:30 PMdouwe_maan
01/29/2021, 3:55 PM