How to insert into all values (and columns) from another table / view?
I realize I could write the raw sql, however I was curious how I would go about creating the following insert statement using kysely.
insert into <table>
select * from <view_or_table>
I was looking over https://kysely-org.github.io/kysely/classes/InsertQueryBuilder.html#values but haven't been able to figure it out.
InsertQueryBuilder | kysely
Documentation for kysely
2 Replies
Unfortunately the API is not at all obvious in this case. Adding a
selectFrom
method to the insert builder is tricky and I haven't figured out a way to do that without duplicating thousands of lines of code.
You can use the expression
method:
https://kyse.link/?p=s&i=wJuSPkyLinHiBKDfHKW0Perfect... that's all I need. thanks!