Drizzle-orm for Vercel, select do not take any argument?

Hi, I want to deploy to Vercel my small app made in Qwik, it seems like Vercel edge do not support Prisma so I migrated to drizzle but I'm facing an odd problem, the vercel package of drizzle expose a .select() without any argument, for example I would like to take only some columns of an entity, and more importantly I want to be able to return a COUNT of the elements, without it I would need to load the entire table 😦
1 Reply
Andrii Sherman
Andrii Sherman•2y ago
Check out this part of docs https://orm.drizzle.team/docs/crud#basic-and-partial-select If sqlite returns count as string you can do this
const result = await db.select({
count: sql<number>`count(*)`.mapWith(Number),
}).from(users);
const result = await db.select({
count: sql<number>`count(*)`.mapWith(Number),
}).from(users);
If sqlite returns count as number you can do this
const result = await db.select({
count: sql<number>`count(*)`,
}).from(users);
const result = await db.select({
count: sql<number>`count(*)`,
}).from(users);
Want results from more Discord servers?
Add your server