Hey, there. I'm using the domain pattern from litestar-fullstack and I'm seeing some behavior I don't fully understand after digging through the code. Wondering if anyone can help.
I've got the following code (obfuscated):
within_period = select(N.s_id).where(N.wt > datetime.now(timezone('UTC')) - timedelta(minutes=self.wait_period_in_minutes)
s_query = select(NS, E.details).join(E, E.d_id == e_id).where(NS.type == type_, NS.j.in_(js), NS.s_id.not_in(within_wait_period)).distinc(tuple_(NS.email, NS.phone))
return await self.list(statement=s_query)
This gives me typing errors, since this returns more data than just list[NS], as the repository/service pattern typically uses, but that's ok for now (though I'd be curious if there's a better, more recommended pattern for handling data that's not just within the one table mapped to the service, while still allowing using the advanced-alchemy code).
It generates the following query:
select distinct on ((ns.emali, ns.phone)) ns.s_id, ...<other_columns>, e.details from ns join e on e.e_id = $1::VARCHAR where ns.type = <other> and ns.j in (...) and ns.s_id not in (select n.s_id from n where n.wt > ...)
This query seems correct, however, when I get the data back, it's a list of NS records, losing the E.details column. Just curious if there's a pattern I should be using when joining tables like this, or any thoughts as to what might be causing this dropping of the column in the select function.