Can I see generated raw sql query that is generated from drizzle-orm query?

Trying to sanity check my query, would be nice to see the query sent in. For example, if I send in: db.update(table).set({ some: 'obj'}).where(eq(table.field, 'newval')); would equate to: UPDATE table SET some = 'obj' WHERE field = 'newval';
2 Replies
Sillvva
Sillvva•9mo ago
Sort of.
db
.update(table)
.set({ some: 'obj'})
.where(eq(table.field, 'newval'))
.toSQL()
db
.update(table)
.set({ some: 'obj'})
.where(eq(table.field, 'newval'))
.toSQL()
This returns the query string, but the parameters are separate. https://orm.drizzle.team/docs/goodies#printing-sql-query
Drizzle ORM - Goodies
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
mare arcis
mare arcisOP•9mo ago
That's close enough. Didn't get that far in the docs. Thank you @Sillvva 🙂
Want results from more Discord servers?
Add your server