Re: [sqlalchemy] from_statement and cte problem

2019-07-01 Thread Mike Bayer
On Mon, Jul 1, 2019, at 5:20 PM, sector119 wrote: > For example I have a property 'path' with CTE like this and it wouldn't > return set of rows, but scalar value as array[] of rows > would it be possible to load this property as subquery() ? I don't know from a SQL perspective you'd likely

Re: [sqlalchemy] from_statement and cte problem

2019-07-01 Thread sector119
For example I have a property 'path' with CTE like this and it wouldn't return set of rows, but scalar value as array[] of rows would it be possible to load this property as subquery() ? Of course I can include that CTE query in my query(Locality) using subquery(), but it would be cool if I'll

Re: [sqlalchemy] from_statement and cte problem

2019-07-01 Thread Mike Bayer
I don't know what you mean. is there SQL you know you want or is that the part you want to figure out? On Mon, Jul 1, 2019, at 4:21 PM, sector119 wrote: > Mike, is it possible to load "@property" as subquery? Maybe as > ARRAY[path_item, path_item, ...] > > воскресенье, 30 июня 2019 г.,

Re: [sqlalchemy] from_statement and cte problem

2019-07-01 Thread sector119
Mike, is it possible to load "@property" as subquery? Maybe as ARRAY[path_item, path_item, ...] воскресенье, 30 июня 2019 г., 20:26:42 UTC+3 пользователь Mike Bayer написал: > > > > On Sun, Jun 30, 2019, at 5:37 AM, sector119 wrote: > > Nice, thanks a lot, Mike, now it works as expected > > >

Re: [sqlalchemy] from_statement and cte problem

2019-06-30 Thread Mike Bayer
On Sun, Jun 30, 2019, at 5:37 AM, sector119 wrote: > Nice, thanks a lot, Mike, now it works as expected that's great. the docs are not good here, there's not enough discussion of "aliased()" , from_statement() and what they do, also I'm changing some details of how they do their work for 1.4

Re: [sqlalchemy] from_statement and cte problem

2019-06-30 Thread sector119
Nice, thanks a lot, Mike, now it works as expected @property def path(self): session = object_session(self) def get_locality_path_q(locality_id): parent_q = session.query(Locality).filter(Locality.id == locality_id).cte(recursive=True) parents = aliased(parent_q)

Re: [sqlalchemy] from_statement and cte problem

2019-06-29 Thread Mike Bayer
On Sat, Jun 29, 2019, at 11:24 AM, sector119 wrote: > Hello, > > I have Locality model with 'path' property to get path from 'root' of tree to > current item, everything works ok, but > I can't get result as Locality instance list.. > When I use >