Skip to main content

PostgreSQL: How to add materialized view as a data table?

Question

I have some materialized views I would like to add as data tables. I can add regular views but materialized views don't seem to show up in the data model. Is there a way to add these?

Answer

Currently, for PostgreSQL, Holistics does list tables and views, but not materialized views.

Behind the scenes, we query the table list from PostgreSQL schema tables which only includes Table & View.

select * from information_schema.tables

Meanwhile, as a workaround, you can create a query model, and use a simple SQL to query from your materialized view following these steps

  1. Click Create new Data Model and select Data Transform
  1. Then in Create Query Model modal, write the query to select data from your materialized view and Run
SELECT * FROM your_materialized_view_name

Finally, save your Data Model. From now on, you can use that Data Model the same way as Data Model from the Table.


Let us know what you think about this document :)