Omit/filter out columns from query

Hey, is there an easy or convenient way with Kysely to filter out data from a query? Lets say I have columns 1,2,3,4,..., 10 and I want to omit column 9, do I have to really list all my columns like this:
select(['1','2','3','4','5','6','7','8','10']
select(['1','2','3','4','5','6','7','8','10']
?
Solution:
Updated version with autocompletion and a list of excludes https://kyse.link/?p=s&i=Z9WWYXTjVPvB901Q1N9M
Jump to solution
5 Replies
bombillazo
bombillazo10mo ago
It;d be awsome if one could do something like:
selectAll({omit: ['9']})
selectAll({omit: ['9']})
koskimas
koskimas10mo ago
There's nothing like that in SQL It's weird that there isn't You can do something like this though https://kyse.link/?p=s&i=S8fqNIBl6QV2mZKOTmTy Kysely doesn't know the existing columns at runtime. You need to manage the list yourself.
bombillazo
bombillazo10mo ago
Ok thanks!
Solution
koskimas
koskimas10mo ago
Updated version with autocompletion and a list of excludes https://kyse.link/?p=s&i=Z9WWYXTjVPvB901Q1N9M
bombillazo
bombillazo10mo ago
Yeah Id have to create the const list array fo columns for each table for this :S but I get the idea, thanks for the brainstroming
Want results from more Discord servers?
Add your server