Anyone know how to generate dbt docs via meltano? ...
# plugins-general
a
Anyone know how to generate dbt docs via meltano?
meltano invoke dbt docs generate
? (seems to be missing some env vars that way or somethign)
a
This isn’t an area I have a lot of experience in yet, but @taylor might have tips. I do think you may need to explicitly add
--project-dir $DBT_PROJECT_DIR --profile $DBT_PROFILE
into that invocation statement. It’s fortuitous that you ask this question today because I was just reviewing @julian_knight’s pending MR that could be leveraged to create a shortcut like
meltano invoke dbt:docs-generate
as described here with some dbt example commands: Add support for shortcut commands for plugins (#2560) · Issues · meltano / Meltano · GitLab I believe in the meanwhile, you may still need to explicitly reference
--project-dir
and
--profile
, but perhaps @taylor or @julian_knight can confirm.
a
Nice. Yeah I figured I might need to set something like that but wasn’t entirely sure what context/environment looks like with
invoke
.
t
I haven’t tried to spin up the docs through invoke, but since
invoke
is just running the specified executable, I suspect you’d have to pass in any of the required args
j
I haven't gotten to play with the docs feature of dbt yet. I know Meltano does specify a number of arguments through DBT_* env vars but I don't know which args vs which you need for the docs subcommand. But as others suggested you can always specify the args explicitly and it should work just fine
a
Sounds good!
ak, so there’s actually an avalanche of unset env vars when trying to
invoke
is the entrypoint to
dbt
commands via
m invoke
very different from how
dbt run
gets executed as part of a
meltano elt … --transform run
sequence?
a
I’m not 100 percent sure on that, but I believe the
elt
version gets additional context that is perhaps not automatically sent in the invoke statement.
Judging by the sample code here on the upcoming “command” feature, I think the additional context needs to be sent manually if using invoke.
j
That's actually not true, in fact I noted this opportunity for confusion in the MR https://gitlab.com/meltano/meltano/-/merge_requests/2028#note_541483601
IIRC the environment variable context comes from the
settings
defined for the plugin. Settings (explicitly and implicitly defined) are passed to the executable under their env var forms
a
Got it! Thanks for clarifying! 👍