Re: [sqlalchemy] question on making a `text` element usable by the ORM?

2018-04-12 Thread Mike Bayer
don't do the alias and use query.from_statement() On Thu, Apr 12, 2018 at 6:30 PM, Jonathan Vanasco wrote: > I have a complicated recursive CTE that exists as text() > > _complex_sql_ = sqlalchemy.text("""WITH RECURSIVE _foos AS ( > SELECT id > FROM foo > WHERE

Re: [sqlalchemy] mapping a class against multiple tables + relationship() .. ?

2018-04-12 Thread Mike Bayer
try sending me a long a full POC and Ill try to play with it, any reason you arne't using declarative? the classical mappings are hard to work with. On Wed, Apr 11, 2018 at 8:32 AM, Mike Bayer wrote: > On Wed, Apr 11, 2018 at 6:15 AM, Julien Cigar

[sqlalchemy] question on making a `text` element usable by the ORM?

2018-04-12 Thread Jonathan Vanasco
I have a complicated recursive CTE that exists as text() _complex_sql_ = sqlalchemy.text("""WITH RECURSIVE _foos AS ( SELECT id FROM foo WHERE (id = :id_start AND ...) UNION SELECT f.id FROM foo f INNER JOIN _foos _f ON _f.id = f.id ) SELECT DISTINCT id FROM

Re: [sqlalchemy] Use of in_() for relationships

2018-04-12 Thread Anvith Shivakumara
I will give has() or any() a try as suggested by Julien. @Mike, I would love to give this feature some more thought, but maybe a couple of days later. :( On Thursday, 12 April 2018 19:44:37 UTC+5:30, Mike Bayer wrote: > > there may have been a very old issue for this but if there was, it's >

Re: [sqlalchemy] Use of in_() for relationships

2018-04-12 Thread Mike Bayer
there may have been a very old issue for this but if there was, it's long forgotten. feel free to propose how you think this feature should work as well as if you have resources to work on it. thanks! On Thu, Apr 12, 2018 at 9:54 AM, Anvith Shivakumara wrote: > I get the

Re: [sqlalchemy] Use of in_() for relationships

2018-04-12 Thread Julien Cigar
On Thu, Apr 12, 2018 at 06:54:08AM -0700, Anvith Shivakumara wrote: > I get the 'NotImplementedError: in_() is not supported for relationship' > exception. maybe you want .has() or .any() ? for ex: session.query(SomeClass).filter( SomeClass.somecollection.any(someproperty='blabla') ) > > Is

[sqlalchemy] Use of in_() for relationships

2018-04-12 Thread Anvith Shivakumara
I get the 'NotImplementedError: in_() is not supported for relationship' exception. Is there any plan to implement this in the near future? ls there any particular reason for not having this implemented? Thanks Anvith -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper