How to use a view after creating it?
Disclaimer: I know that the views functionality is WIP
I have set up a view as described in https://orm.drizzle.team/docs/views/. Now I want to use it to perform a query, but I don't know how. Can I get a pointer to how this is done?
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
6 Replies
like a regular table, just using view schema.
@Rafael Rossi
await db.select().from(View)
doesn't work for me. It is saying that relation "pg_view" does not exist
. What is going on? I ran drizzle-kit push:pg
and generate, am I missing something?@Rami works for me
@nk Did you not have to manually create the materialized view outside of drizzle? It didn't work for me until I manually created the view with SQL. From what I understand drizzle-kit doesn't yet generate the views for us, so how else did you create the view if not manually?
@Rami I just created it manually and defined it there
You could run a sql`` command to create it if you want
Yeah makes sense, appreciate the help😊