Re: [sqlalchemy] Geo query support in SqlAlchemy

2017-02-22 Thread mike bayer
well, GeoAlchemy was based off of a simple proof of concept and modern SQLAlchemy has a lot more API hooks to build up custom expression behavior.This would be dealing mostly with APIs at docs.sqlalchemy.org/en/latest/core/custom_types.html and in particular defining new operators

Re: [sqlalchemy] Using CTEs inside union()

2017-02-22 Thread Michael Williamson
On Wed, 22 Feb 2017 11:15:05 -0500 mike bayer wrote: > > > On 02/22/2017 10:17 AM, Michael Williamson wrote: > > Using CTEs directly inside union() (or similar functions such as > > intersect()) causes an error: > > > > > > query_1 = s.query(Record.id).cte() > >

Re: [sqlalchemy] self-referential many-to-many with single attribute

2017-02-22 Thread Matthew Brookes
Hi Mike, Thanks for the pointers. I take your point about directionality, but it feels like this is a special case that intuitively should work the same way for a single model that it does for two. However for now, it does what it does. I took at look at using a union @property, and while it

Re: [sqlalchemy] Using CTEs inside union()

2017-02-22 Thread mike bayer
On 02/22/2017 11:25 AM, Michael Williamson wrote: On Wed, 22 Feb 2017 11:15:05 -0500 mike bayer wrote: On 02/22/2017 10:17 AM, Michael Williamson wrote: Using CTEs directly inside union() (or similar functions such as intersect()) causes an error: query_1

Re: [sqlalchemy] Forcing filters to use same type as field

2017-02-22 Thread mike bayer
On 02/22/2017 04:23 PM, Chris Frey wrote: Hi, We're using MySQL, and we have tables that use a GUID as the ID. Unfortunately, if the GUID starts with a number, and if you select using an integer, mysql will helpfully convert for you: mysql> select id from table where id = 2;

[sqlalchemy] Forcing filters to use same type as field

2017-02-22 Thread Chris Frey
Hi, We're using MySQL, and we have tables that use a GUID as the ID. Unfortunately, if the GUID starts with a number, and if you select using an integer, mysql will helpfully convert for you: mysql> select id from table where id = 2; +-+ | id

[sqlalchemy] Re: Status of cascading polymorphism, in docs as well

2017-02-22 Thread Shane Carey
Works great for me On Tuesday, February 21, 2017 at 2:56:58 PM UTC-6, Shane Carey wrote: > > I understand from the docs and several questions both here and on > bitbucket that cascading polymorphism is not supported. This > is what it says on the docs: > > Warning > > Currently, *only one

[sqlalchemy] Using CTEs inside union()

2017-02-22 Thread Michael Williamson
Using CTEs directly inside union() (or similar functions such as intersect()) causes an error: import os from sqlalchemy.event import listens_for from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base =

[sqlalchemy] inspecting attribute_mapped_collection info of RelationshipProperty?

2017-02-22 Thread YKdvd
Let's say I have a model class Child, with an Integer column "birthOrder" and text column "birthSign", and a class Parent which has "children = relationship('Child', collection_class=attribute_mapped_collection('birthOrder'))". This gives Parent a dictionary "children", keyed by the birth

Re: [sqlalchemy] inspecting attribute_mapped_collection info of RelationshipProperty?

2017-02-22 Thread mike bayer
On 02/22/2017 08:56 PM, YKdvd wrote: Let's say I have a model class Child, with an Integer column "birthOrder" and text column "birthSign", and a class Parent which has "children = relationship('Child', collection_class=attribute_mapped_collection('birthOrder'))". This gives Parent a

Re: [sqlalchemy] Using CTEs inside union()

2017-02-22 Thread mike bayer
On 02/22/2017 10:17 AM, Michael Williamson wrote: Using CTEs directly inside union() (or similar functions such as intersect()) causes an error: query_1 = s.query(Record.id).cte() query_2 = s.query(Record.id).cte() select_from = union(query_1, query_2) what does the above