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:
?
Solution:Jump to solution
Updated version with autocompletion and a list of excludes https://kyse.link/?p=s&i=Z9WWYXTjVPvB901Q1N9M
5 Replies
It;d be awsome if one could do something like:
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.
Ok thanks!
Solution
Updated version with autocompletion and a list of excludes https://kyse.link/?p=s&i=Z9WWYXTjVPvB901Q1N9M
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