I have existing table and column comments in my Redshift database for each table within a schema. I would like to extract this information and use it as source descriptions in dbt instead of manually inputting the details again. How can I achieve this?
I’m using dbt-core==1.4.9 dbt-redshift==1.4.0 and python 3.7.16
Example
This query is used to enter comments on table and column
comment on table actor is 'Actor table';
comment on column actor.first_name is 'This is the first name of actor';
Now I want to extract this to schema.yml so as to look like this
sources:
- name: dbname
description: actors database
database: acting
schema: act
tables:
# From here on, the documentation should be autogenerated by extracting from the db
- name: actor
description: Actor table
columns:
- name: first_name
description: This is the first name of actor