[BUG]: Materialized views not being included in the schema file with introspect:pg
What version of drizzle-orm are you using?
0.29.3
What version of drizzle-kit are you using?
0.20.10
Describe the Bug
- I am running
introspect:pgon my database in order to get the schema exported as usable references however I am noticing that while this works for tables, materialized views are not included.
Expected behavior
I expect my materialized view to be included in the generated schema. I assume this is a bug because there is clear support for views/mat views given that there is an export for pgMaterializedView and pgView from drizzle-orm/pg-core.
Environment & setup
I am connecting to postgres and trying to generate a schema file from an existing database which includes a materialized view.
It should be irrelevant but my database is Timescaledb (postgres under the hood) and the materialized view in question is a vanilla postgres mat view and NOT the timescale continous aggregate view feature.
Table:
create table public.stock_split (
dt date not null,
symbol text not null,
"from" integer not null,
"to" integer not null,
primary key (dt, symbol)
);
Materialized View:
create materialized view public.stock_split_realized as
SELECT a.dt,
a.symbol,
exp(sum(ln(b."to"::numeric / b."from"::numeric))) AS denominator
FROM stock_split a
JOIN stock_split b ON a.symbol = b.symbol AND a.dt <= b.dt
GROUP BY a.dt, a.symbol;
hey @juanjalvarez considering using timescaledb with drizzle as well. How is your experience so far?
In the docs they mention that it's not yet supported by drizzle-kit. If you go to the top of the views page, you will see this message:
We are working on adding it to drizzle-kit. You can track it here: https://github.com/drizzle-team/drizzle-orm/issues/1856
@juanjalvarez @iamcrisb did you try using drizzle with timescaledb? I am considering drizzle myself and I am in process of choosing orm for my project. Thanks
hey @tonven you won't find any orm that supports timescale, regardless of the orm you'll have to write sql, so drizzle is as good of choice as anything else.