troubleshooting

How to fix the error related to invalid value in PostgresRelation while using risingwave dbt plugin?

I encountered a runtime error in the dbt logs with the message 'Field "type" of type Optional[RelationType] in PostgresRelation has invalid value 'source''. The issue seems to be related to the query generated by DBT where different table types are handled. How can I fix this error?

Ma

Matan Perelmuter

Asked on Oct 03, 2023

  1. The error is caused by different table types ('materializedview' and 'source') in the query generated by DBT. To fix this error, you need to adjust the query to handle these different table types appropriately.

  2. Update the query to correctly handle the 'materializedview' and 'source' table types by modifying the logic in the case statement.

  3. Here is an example of how you can adjust the query to handle the different table types:

select distinct
    table_schema as "table_schema",
    table_name as "table_name",
    case table_type
        when 'BASE TABLE' then 'table'
        when 'FOREIGN' then 'external'
        when 'MATERIALIZED VIEW' then 'materializedview'
        when 'source' then 'source'
        else lower(table_type)
    end as "table_type"
from dev.information_schema.tables
where table_schema ilike 'public'
and table_name ilike 'base_events%'
and table_name not ilike ''
Oct 03, 2023Edited by