Re: [sqlalchemy] Possible to pass array of (table, conditions) to join() like where()/select() ?

2022-09-16 Thread Mike Bayer
On Fri, Sep 16, 2022, at 12:10 PM, mkmo...@gmail.com wrote: > I use the following pattern in my REST APIs, building up the select, joins, > where conditions, group bys, order bys, depending on the query parameters > passed in by the user: > > selects = [Foo] > joins = [(Bar, Foo.c.id

[sqlalchemy] Possible to pass array of (table, conditions) to join() like where()/select() ?

2022-09-16 Thread mkmo...@gmail.com
I use the following pattern in my REST APIs, building up the select, joins, where conditions, group bys, order bys, depending on the query parameters passed in by the user: selects = [Foo] joins = [(Bar, Foo.c.id == Bar.c.foo_id)] where_conditions = [Foo.c.id == request.args['pk']]

Re: [sqlalchemy] Can’t make the Composite Comparator work…

2022-09-16 Thread jens.t...@gmail.com
Thank you Simon! That worked indeed and makes a lot of sense. I think I misinterpreted the documentation a bit in that sense; it did puzzle that SQLA would patch all these mapped objects… Based on your example: *>>> dbsession.query(Vertex).filter(Vertex.start > Point(2, 2)).all()*

Re: [sqlalchemy] Can’t make the Composite Comparator work…

2022-09-16 Thread Simon King
(I haven't used any of these features, so the following is just a guess) In your assertion, you are comparing two *Point instances*. The SQLAlchemy comparator_factory mechanism has not made any changes to the Point class itself, and Point doesn't define __gt__, hence your TypeError. The point of

[sqlalchemy] Can’t make the Composite Comparator work…

2022-09-16 Thread jens.t...@gmail.com
Hello, I’m noodling through the Composite Column Types examples, and can’t make it work. Based on the code on that page I put together a minimal, reproducible example