[sqlalchemy] Automatic created and modified timestamp columns (best practice?!)

2013-03-29 Thread Moritz Schlarb
whether to omit data for modified or not based on the actual database dialect used? Hope my questions came out clear and maybe someone can help me! Cheers -- Moritz Schlarb -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

[sqlalchemy] Automatic created and modified timestamp columns (best practice?!)

2013-03-27 Thread Moritz Schlarb
Hi there everyone, I am kind of looking for a best practice on how to implement automatically setting and updating columns for created and modified timestamps in SQLAlchemy, preferrably database-agnostic. First of all, is DateTime the appropriate column type or should it be timestamp instead?

[sqlalchemy] Reflect class sorting based on __mapper_args__['order_by']

2013-02-15 Thread Moritz Schlarb
Hi there, I'd like to be able to run sorted() on a list of model objects without class-specific code which sorts based on what's specified in __mapper_args__['order_by']. To do that, I would add __lt__(), __le__(), __gt__(), and/or __ge__() to the declarative base class, which try to get the

Re: [sqlalchemy] How to properly use a property for self._value or self.parent.value

2012-05-02 Thread Moritz Schlarb
Michael Bayer: On Apr 21, 2012, at 7:06 AM, Moritz Schlarb wrote: So basically, a Child object may set it's own value for time, but if it's not set, it uses the value from its parent. This works, but I would also like to be able to do something like: session.query(Child).filter

[sqlalchemy] How to properly use a property for self._value or self.parent.value

2012-04-21 Thread Moritz Schlarb
Hi at all, I haven't found something by googling, but I'm also not sure about the right search terms, so I hope some can help me here. I have a model like this: class Parent(DeclarativeBase): id = Column(Integer, primary_key=True) time = Column(Float) another_id = Column(Integer)