[sqlalchemy] sqlite string concats and datetime arithmetics

2013-08-29 Thread Greg Yang
I'm trying to get a series of datetimes using func.datetime. The format of input is func.datetime(basetime, '+ NNN seconds'), which works nicely if the shift applied is constant. However I need to add 10, 20, 30 seconds, etc to this base time. So I want something like func.datetime(basetime,

[sqlalchemy] unregister mapper event

2013-07-16 Thread Greg Yang
Is it possible to remove mapper events? Specifically I want to call event.remove(mapper, 'mapper_configured', fn) but I get an error back saying Mapper is not iterable. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this

[sqlalchemy] kivy and sqlalchemy

2013-07-10 Thread Greg Yang
I'm writing an application that uses kivy for GUI and sqlalchemy for ORM. Each has its own instrumentation system, and I initially planned to connect them by 1) mirroring relevant SA attributes in kivy at init, 2) work with only the kivy versions of the attributes for the duration of the app,

Re: [sqlalchemy] Strange behavior with a class inheriting from AssociationProxy

2013-07-09 Thread Greg Yang
= relationship('AB', collection_class=attribute_mapped_collection('a') ) @event.listens_for(A.ab, append) def append(target, value, initiator): value.b.ab[value.a] = value On Jul 8, 2013, at 9:07 PM, Greg Yang sorcer...@gmail.com javascript

[sqlalchemy] Strange behavior with a class inheriting from AssociationProxy

2013-07-08 Thread Greg Yang
I created a class CorrelatedProxy inheriting from AssociationProxy that allows the creator function to depend on the owner instance of the association proxy. Essentially it gets a attribute 'correlator' of the something like lambda x: lambda y, z: Constructor(x, y, z), and then intercepts the

Re: [sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-12 Thread Greg Yang
).options(joinedload(children)): for b in beta.children: assert b.id == beta.id assert b.a_re in beta.a_re.children On Jun 11, 2013, at 6:34 PM, Greg Yang sorcer...@gmail.com javascript: wrote: How would you use proxies? I can get B.a_re.children.b_re, but this includes

[sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-11 Thread Greg Yang
Consider these 2 mapped classes from sqlalchemy.engine import create_engine from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative.api import declarative_base from sqlalchemy.orm import relationship from sqlalchemy.orm.session import sessionmaker from

Re: [sqlalchemy] self-referential one to many relationship with a kind of composite foreign key

2013-06-11 Thread Greg Yang
, that represents all the intermediary rows. Might work, might not, would have to spend a few hours with it. Is there a reason you can't just route to the related B.a.children.bsusing proxies? Or a @property based loader? On Jun 11, 2013, at 4:45 PM, Greg Yang sorcer...@gmail.com

[sqlalchemy] Ordering by composite column gives sqlite3 OperationalError

2013-06-09 Thread Greg Yang
Right now query.order_by(composite) gives a sqlite3 operational error, because the rendered SQL is ORDER BY (composite_val1, composite_val2, composite_val3) instead of ORDER BY composite_val1, composite_val2, composite_val3. (The parenthesis is causing an error) For example, consider the code

Re: [sqlalchemy] AssociationProxy's behavior with == None seems unintuitive

2013-06-08 Thread Greg Yang
Awesome! The changes should be able to cover the issue. On Saturday, June 8, 2013 12:40:51 PM UTC-5, Michael Bayer wrote: On Jun 8, 2013, at 1:33 AM, Greg Yang sorcer...@gmail.com javascript: wrote: if __name__ == '__main__': engine = create_engine('sqlite:///:memory

[sqlalchemy] AssociationProxy's behavior with == None seems unintuitive

2013-06-07 Thread Greg Yang
Right now a filter clause AssociationProxy == None Consider the following code: from sqlalchemy.engine import create_engine from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative.api import declarative_base from sqlalchemy.orm import relationship from