Re: [sqlalchemy] Dynamic relations...

2011-02-13 Thread Martijn Moeling
You are right in the misunderstood relation. I see the primary key in extra to be wrong, extra should have it's own I'd column being an auto number. In extra it should be possible to have many records pointing to 1 ext variant. Sorry for that. The extra, should also work with tables without a

Re: [sqlalchemy] SQLAlchemy 0.7 beta 1 released

2011-02-13 Thread Jon Nelson
On Sat, Feb 12, 2011 at 8:11 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Feb 12, 2011, at 8:29 PM, Jon Nelson wrote: On Sat, Feb 12, 2011 at 6:51 PM, Michael Bayer mike...@zzzcomputing.comwrote: Hey list - The first beta release of SQLAlchemy 0.7 is available for download.

Re: [sqlalchemy] Dynamic relations...

2011-02-13 Thread Michael Bayer
On Feb 13, 2011, at 6:14 AM, Martijn Moeling wrote: You are right in the misunderstood relation. I see the primary key in extra to be wrong, extra should have it's own I'd column being an auto number. In extra it should be possible to have many records pointing to 1 ext variant. Sorry

Re: [sqlalchemy] how to make version_id_generator use values from postgresql sequence

2011-02-13 Thread Michael Bayer
On Feb 13, 2011, at 1:39 PM, Andrey Gladilin wrote: I am trying to create a version column which would use values from a single postgresql sequence. record_versions_id_seq = Sequence('record_versions_id_seq') class TimestampMixin(object): created_at = Column(DateTime,

Re: [sqlalchemy] Dynamic relations...

2011-02-13 Thread Martijn Moeling
Michael, I looked at the code and I can not say more than that its very interesting, I have to see how it works and more importantly how It fits into my objects but it seems clear enough to do so. I really appreciate your work on SQLAlchemy and all the time you spend to help us users out.

Re: [sqlalchemy] Dynamic relations...

2011-02-13 Thread Michael Bayer
a polymorphic association is hard. that's why I have three examples of them and soon a fourth.Though they are a subset of a larger batch of tricks that I've been using in my own work with declarative for the past year to automate lots of different kinds of patterns, perhaps there's a

[sqlalchemy] Re: Dynamic relations...

2011-02-13 Thread Eric Ongerth
Polymorphic associations pop up a lot around here, don't they! I suppose it's partly because they would be so much more difficult to handle, or even come close to handling, conveniently, with most other ORM packages. Martijn, after running into the wall on polymorphic associations approximately

[sqlalchemy] Re: how to make version_id_generator use values from postgresql sequence

2011-02-13 Thread Andrey Gladilin
Thanks Michael for your answer. Shame on me, that I did not find this point in documentation. But such behaviour seems strange to me. Why should I specify these parameters in anchestors, specify anchestors in a child class and then explicitly describe my arguments once more in a child class? I

[sqlalchemy] Re: how to make version_id_generator use values from postgresql sequence

2011-02-13 Thread Andrey Gladilin
And finally I have found solution: class TimestampMixin(object): created_at = Column(DateTime, default=func.now()) record_version = Column(Integer, nullable=False, default=func.nextval(record_versions_id_seq)) @declared_attr def __mapper_args__(self): return {