Justin
Justin
DTDrizzle Team
Created by seckraken on 6/14/2024 in #help
Create a view with Drizzle
So here the views are not populating under the db.query object yet, you would need to do your view queries like this instead (for now):
db.select().from(myView)
db.select().from(myView)
I imagine this will improve in time, but this is what works currently
8 replies
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
So I just had a play with it, and unfortunately alias was not the answer I had thought it would be. You would need to do something like this:
import { sql } from 'drizzle-orm';
// insert your other code here...
const result = await unionAll(a, b).orderBy(sql`transactionId`);
import { sql } from 'drizzle-orm';
// insert your other code here...
const result = await unionAll(a, b).orderBy(sql`transactionId`);
I was originally hoping to wrap the unionAll in an alias(unionAll, 'myUnion'), but unfortunately it did not work as I had thought at the time. But the sql operator solves your problem 🙂
9 replies
DTDrizzle Team
Created by pax on 4/26/2024 in #help
Querying a materialized view: relation does not exist
No description
4 replies
DTDrizzle Team
Created by seckraken on 6/14/2024 in #help
Create a view with Drizzle
Basically, currently the code won't generate the views, but will allow you to query against existing ones. It's a known limitation 🙂
8 replies
DTDrizzle Team
Created by seckraken on 6/14/2024 in #help
Create a view with Drizzle
No description
8 replies
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
Did you still need help with this, or did you figure it out? 🙂
9 replies
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
Personally I would create an alias of the union, and then create your orderBy with the alias variable. It makes the code a bit more clear as to what you’re doing. I’m currently heading to the airport at the moment, so if you can’t solve it within that bit of info, let me know and I’ll give you an example after I land.
9 replies