DT
Drizzle TeamMyrseth
Placeholders in inserting: db.insert().values(placeholder('example'))
Hey, how do I add placeholders inside the values of an insert prepare statement? I get an typeerror when I do so.
M
Myrseth•303d ago
My current code that results in a typeerror is the following:
I have no issue using placeholders in delete, and select statements, only in this case.
If this is not supported, how can I implement this in something like Vercel Functions?
A
Alpap•159d ago
same issue here i would love to hear the answer to this issue
ok found the answer this worked for me
db.insert(users)
.values({
email: sql.placeholder('email'),
name: sql.placeholder('name'),
emailVerified: sql.placeholder('emailVerified'),
image: sql.placeholder('image'),
active: sql.placeholder('active'),
roles: sql.placeholder('roles'),
company: sql.placeholder('company')
})
.onConflictDoNothing()
.prepare('insert_users')
A
Angelelz•158d ago
I don't know that you're supposed to use placeholders for the whole values object or array
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.3KMembers
View on DiscordWant results from more Discord servers?
More PostsCan I add a Unique constraint to a column?I couldn't find an option for that in the docs. I'm assuming Drizzle doesn't support that.
So, coul"Cannot parse date or time" using AWS Data API, aurora postgresI'm trying drizzle-orm (with sst) and aurora pg thru aws data api, when trying to insert a Date valuFiltering against a relationI have a orgs table that have a many to many relation with a users table.
while querying with the fGet type for select query?Hey guys, is there a way to infer the "select" type for a given table? for example:
```ts
async getorderBy related table columnGiven a relational query such as
```
const matchResult = await db.query.matches.findMany({
Soft Delete StrategyI'm a person of eloquent taste; one who prefers the soft delete. With the current feature set of driColumns that not allowed to updatedHi guys, I'm looking for a proper way to declare SQL schema and its `InferModel` types when there'rExecute sql with '?' as parameterHello everyone.
Please, how do I execute a sql that uses as a parameter the character '?' ?
For examForeign Key Reference to auth Schema Not Generated in CodeI'm having an issue with my Drizzle-ORM code where the foreign key reference to the 'auth' schema isHow can I add a Prefix Index?I migrated from Prisma, and I have a column with `varchar(2000)` which I indexed with `@@index([colu