[sqlalchemy] Python 3.4 Enum type

2013-08-06 Thread Ian Kelly
Since Python 3.4 is adding support for enums to the standard library, I wrote a TypeDecorator for it: import sqlalchemy.types as types class PythonEnum(types.TypeDecorator): impl = types.Enum def __init__(self, enum_class, **kw): super().__init__(*(m.name for m in enum_class),

Re: [sqlalchemy] Python 3.4 Enum type

2013-08-06 Thread Michael Bayer
there's a lot of flavors of python enum and I recall the standard library one rubs me the wrong way a bit. I'd prefer for sqlalchemy.Enum to have some easy way to accommodate any Python-side enum using some kind of convention, obviously one that's compat with the std lib enum. On Aug 6,

[sqlalchemy] Association Proxy question ( or other ORM feature )

2013-08-06 Thread Jonathan Vanasco
I have three tables that are structured somewhat like this: Document * id * all_images = sa.orm.relationship(Document2Image) Image * id * all_documents = sa.orm.relationship(Document2Image) Document2Image * id * document_id * image_id * image_type_id * document = sa.orm.relationship(Document)

Re: [sqlalchemy] Association Proxy question ( or other ORM feature )

2013-08-06 Thread Michael Bayer
On Aug 6, 2013, at 6:23 PM, Jonathan Vanasco jonat...@findmeon.com wrote: I have three tables that are structured somewhat like this: Document * id * all_images = sa.orm.relationship(Document2Image) Image * id *

[sqlalchemy] notin_ passed empty sequence with unexpected substitution

2013-08-06 Thread Victor Reichert
Hi, I'm running: selected_eventids = [] selected_event = self.session.query(Master_Simulation_Event).filter(Master_Simulation_Event.cumulative_probability = selection_percentile, Master_Simulation_Event.event_id.notin_(selected_eventids) ).\