0
WITH unioned_product_reports AS(
    {% set prod_relations = dbt_utils.get_relations_by_pattern('xyz_shema', 'test_products%') %}
    {{ dbt_utils.union_relations(relations = prod_relations) }}
    ranking_product_report_rows AS(
        SELECT *,
            ROW_NUMBER() OVER(PARTITION BY date, name ORDER BY batch_runtime DESC) rno
        FROM unioned_product_reports
    )
)

In dbt I am trying to union all tables by above using above dbt-utils packages but it showing error as:

Server error: Database Error in rpc request (from remote system) syntax error at or near ")" LINE 13: )

can someone suggest solution.

zhulien
  • 5,145
  • 3
  • 22
  • 36
MegaBytes
  • 6,355
  • 2
  • 19
  • 36
  • Does the SELECT statement work if you run it directly against your DB rather than via DBT? – NickW Mar 23 '21 at 12:52
  • Is this the whole model? If so I think it's missing a `SELECT * FROM ranking_product_report_rows` edit: it also seems like the first CTE might be missing a `),` at the end... – Josh D. Mar 23 '21 at 14:15
  • @JoshD. Yeah, I am doing select * from ranking_product_rows but the error comes before that in `WITH unioned_product_reports AS` this block only – MegaBytes Mar 23 '21 at 19:23

1 Answers1

0

I don't know which database you are connecting to. I had the same error when connecting to Snowflake and fixed it with:

Go to the top right corner and click "settings gear", Go to profile settings, Go to credentials, Under credentials, select the Profile you are working on

  • Right slide menu will pop

Scroll down to development credentials and click the green connect snowflake account button. Or add the credentials you are using to connect to the respective DB. For me Snowflake, it should reconnect your snowflake authentication and you should be good to go

Hope it helps

TKAY
  • 66
  • 2