© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
7 replies
Titan

Insert returning api to match select columns

I have the following helpers to select the right columns and ensure I don't leak sensitive data:

export const userSelectPublicColumns = { id: true, firstName: true, lastName: true }
export const userSelectSensitiveColumns = {
  ...userSelectPublicColumns,
  email: true,
  mobileNumber: true,
export const userSelectPublicColumns = { id: true, firstName: true, lastName: true }
export const userSelectSensitiveColumns = {
  ...userSelectPublicColumns,
  email: true,
  mobileNumber: true,


However when I come to call
insert().returning()
insert().returning()
it seems the .returning() method takes a different shape and I'll need to duplicate my objects values above from boolean
true
true
to
table.columnKey
table.columnKey


Anyway around this duplication?
image.png
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

insert returning relations
Drizzle TeamDTDrizzle Team / help
3y ago
insert from select
Drizzle TeamDTDrizzle Team / help
12mo ago
Using prisma to select columns not returning what I'm passing
Drizzle TeamDTDrizzle Team / help
11mo ago