11 Replies
Currently it's unavailable in drizzle. We have a simple logic for inserts for now
But you can use
sql
also how to do Union or union all with two query in drizzle?
https://discord.com/channels/1043890932593987624/1126421647289749545
is possible now in drizzle?
same thing, Union was a last part in drizzle selects that we didn't implement yet
We will fix slow intelisense first and then come back for such features
Slow ts server is our priority right now
that's great. it will be really helpful about ts server slowness.
thank you for your reply 🙏
any updates on this by any chance? was in need of something similar and was wondering if it has been implemented in the meanwhile, sql builder should work fine though
sql
magic operator like:
generates query like:
which is invalid:
How to remove table prefix per field in table call?you can just write the names of the columns directly, i havent found another way
although in your case you could probably just use
db.insert()
since the query is straight forward (unless the query you provided is just an example and in reality yours is much more complex)wydm at "just use
db.insert()
"?
select
first then insert
I guess?nvm, you cant
you should either use
sql
with the embedded column names, or a transactionThere is an open PR for this feature. It's in the works https://github.com/drizzle-team/drizzle-orm/pull/1605
GitHub
Add support for
insert into ... select
by L-Mario564 · Pull Reque...Addresses #398.
This PR adds support to insert rows from one table into another via the insert into ... select syntax.
The following is valid Drizzle syntax:
const users = pgTable('users', ...
While waiting for new API in the PR, use
sql.raw
keep the field name as-is to make it work: