AdamRackis
Explore posts from serversDTDrizzle Team
•Created by AdamRackis on 9/16/2023 in #help
Possible to select* off of Joined table?
Consider this SQL query
I have it converted to this Drizzle query, which looks to be correct.
My question is, is it possible to just
select *
from the joined table, without listing out every field?
I realize I could probably flip the query around and do a right join, but I don't want to do that; I'd rather keep listing out all the fields if that's my only option.
Does Drizzle have a shortcut for this?5 replies
DTDrizzle Team
•Created by AdamRackis on 9/15/2023 in #help
InferModelFromColumns with columns defined with sql``
Let's say I have a select list that looks like this
This works fine, but if I try to use it with
InferModelFromColumns
, like so
export type FullBook = InferModelFromColumns<typeof defaultBookFields>;
I get a TS error - the tags and subjects fields are not Columns, but rather ad hoc SQL results.
I do know how to work around this. I could easily Omit<> those two columns, and then manually append a tabs and subjects property of the right type.
But is there any way to make this work as is?
Absolutely love this library by the way - thank you for the amazing work!15 replies