executing query builder sql

Dumb question but what's the best means of executing the result of my query builder? https://orm.drizzle.team/docs/goodies#standalone-query-builder
// what's the best way to execute this sql / parms?
const { sql, params } = query.toSQL();
// what's the best way to execute this sql / parms?
const { sql, params } = query.toSQL();
2 Replies
Angelelz
Angelelz11mo ago
Depends on your driver The query builder is the result of having drizzle without a driver. You can get the sql statement but it cannot be run unless you run it manually with a driver
Aaron
Aaron11mo ago
Thank you, just found I can use format from @planetscale/database to get my rawSql to pass into sql.raw()
const { rows } = await db.execute(sql.raw(rawSql));
const { rows } = await db.execute(sql.raw(rawSql));
Want results from more Discord servers?
Add your server