Dbt: The json output for `ls` should include the database representation

Created on 23 Jul 2020  Â·  1Comment  Â·  Source: fishtown-analytics/dbt

Steps to reproduce

$ dbt list --resource-type model --output json

Expected behavior

I expected there to be a key like database_representation

Actual behavior

The closest we currently get is alias, and some config detail

{
   "package_name":"jaffle_shop",
   "name":"customers",
   "resource_type":"model",
   "alias":"customers",
   "config":{...},
   "tags":[

   ],
   "depends_on":{...}
}

The output of dbt --version:

installed version: 0.17.1
   latest version: 0.17.1

Up to date!

Plugins:
  - bigquery: 0.17.1
  - snowflake: 0.17.1
  - redshift: 0.17.1
  - postgres: 0.17.1

Additional context

Use case from Slack: listing the database objects that will be affected by a dbt run

Note that the node returned here does not include a key for "database_representation" (or ismilar)

Alternatives

I messed around quickly, and added database, schema, and identifer to the list of ALLOWED_KEYS here, and could got this far:.


$ dbt list --resource-type model --output json | jq '.database + .schema + .alias'

"analyticsdev_ccarrollcustomers"
"analyticsdev_ccarrollorders"
"analyticsdev_ccarrollstg_customers"
"analyticsdev_ccarrollstg_orders"
"analyticsdev_ccarrollstg_payments"

Which is pretty close — is that a better solution? That breaks down if we're going to include quoting in this though

bug

Most helpful comment

This is interesting, I am having a very similar issue working on #2641 - we'll probably be able to mark this as a "good first issue" once that's done. As dbt is today, this will be kind of annoying to fix.

>All comments

This is interesting, I am having a very similar issue working on #2641 - we'll probably be able to mark this as a "good first issue" once that's done. As dbt is today, this will be kind of annoying to fix.

Was this page helpful?
0 / 5 - 0 ratings