risingwavelabs / dbt-risingwave

Apache License 2.0
21 stars 6 forks source link

Support persisting documentation #31

Open james-johnston-thumbtack opened 10 months ago

james-johnston-thumbtack commented 10 months ago

RisingWave supports COMMENT ON syntax, as documented here: https://docs.risingwave.com/docs/current/sql-comment-on/

However, if I set the persist_docs config like this, as documented at https://docs.getdbt.com/reference/resource-configs/persist_docs:

    +persist_docs:
      relation: true
      columns: true

Then dbt will fail with an error like this:

10:11:19  SQL status: CREATE_MATERIALIZED_VIEW in 8.0 seconds
10:11:19  Using risingwave connection "model.tt_rw_staging.stg_my_view.v1"
10:11:19  On model.tt_rw_staging.stg_my_view.v1: /* {"app": "dbt", "dbt_version": "1.6.9", "profile_name": "thumbtack_rw", "target_name": "local", "node_id": "model.tt_rw_staging.stg_my_view.v1"} */

  comment on materialized_view "thumbtack"."dbt_jamesjohnston_stg_business"."stg_my_view_v1" is $dbt_comment_literal_block$This is the description of my table
$dbt_comment_literal_block$;

10:11:19  Postgres adapter: Postgres error: Failed to run the query

Caused by:
  sql parser error: Expected comment object_type, found: materialized_view at line:5, column:31
Near "
  comment on materialized_view"

Obviously this is invalid SQL.... I'm guessing the feature is not supported yet.

Definitely a low-priority nice-to-have for me, since I'll also be looking at using the dbt documentation generator. But in the future it would be nice if anyone directly browsing the database can have these descriptions close at hand.

morsapaes commented 6 months ago

This is a bug in the dbt-postgres adapter (which this adapter shims). We fixed it a while back in our own adapter (dbt-materialize), but I just opened a PR to also fix it upstream: https://github.com/dbt-labs/dbt-postgres/pull/98.

neverchanje commented 6 months ago

@james-johnston-thumbtack which dbt driver are you using for RW? dbt-risingwave or dbt-postgres?

james-johnston-thumbtack commented 6 months ago

@neverchanje I was testing with the dbt-risingwave adapter.

morsapaes commented 6 months ago

The dbt-risingwave adapter inherits from dbt-postgres. What I meant is that once this is fixed in dbt-postgres, it'll just work for this adapter too.