[sqlalchemy] Re: How to get setter-like behaviour universally across a custom type? (with UTC DateTime examples)

2011-06-30 Thread Russ
I discovered the sqlalchemy.orm.validates decorator, which executes when I want it to (on attribute assignment) so I got out my hacksaw and tried to make it work in one fell swoop... implementing automatic UTC assignment for all UTCEnforcedDateTime columns. I'm not comfortable with it yet... but

[sqlalchemy] mortar_rdb 1.2.0 released!

2011-06-30 Thread Chris Withers
Hi All, I'm pleased to announce a new release of mortar_rdb. This package ties together SQLAlchemy, sqlalchemy-migrate and the component architecture to make it easy to develop projects using SQLAlchemy through their complete lifecycle. Changes in this release were: - Pass None as the default

Re: [sqlalchemy] mortar_rdb 1.2.0 released!

2011-06-30 Thread Wichert Akkerman
On 06/30/2011 10:14 AM, Chris Withers wrote: - Specify sqlalchemy 0.6 as a requirement, until zope.sqlalchemy is ported, mortar_rdb shouldn't be used with :mod:`sqlalchemy` 0.7. What is missing? zope.sqlalchemy seems to work fine with sqlalchemy 0.7 as far as I've seen. WIchert. -- You

[sqlalchemy] Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-06-30 Thread Adrian
SQAlchemy 0.7.1 / pyscopg 2.2.1 / PostgreSQL 9.0 --- I have a weird problem with orm queries that contain custom functions, in this case from postgres contrib modules. When I do a query like this session.query(Entity,

Re: [sqlalchemy] Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-06-30 Thread Michael Bayer
On Jun 30, 2011, at 9:23 AM, Adrian wrote: SQAlchemy 0.7.1 / pyscopg 2.2.1 / PostgreSQL 9.0 --- I have a weird problem with orm queries that contain custom functions, in this case from postgres contrib modules. When I

Re: [sqlalchemy] Full-fledged objects as mapped attributes?

2011-06-30 Thread Michael Bayer
your question has arrived at the same time almost the exact same question is coming from another user Russ, so I've added an example of how to use attribute events in conjunction with a TypeDecorator, so that the data is coerced both at the database level, as well as at the attribute setter

Re: [sqlalchemy] Re: How to get setter-like behaviour universally across a custom type? (with UTC DateTime examples)

2011-06-30 Thread Michael Bayer
you're close, I've added a note to the validates documentation at http://www.sqlalchemy.org/docs/orm/mapper_config.html#simple-validators that will point a reader on to the more comprehensive solution. I've added an example for you as well as Jason who asked almost the same question earlier,

[sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Moch Ramis
SQAlchemy 0.7.1 / pyscopg 2.2.4 / PostgreSQL 8.4 -- Hello everyone. I recently profiled a task that was making an abusive use of inserts and queries through sqlalchemy after having requested 1094 objects from the

Re: [sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Michael Bayer
On Jun 30, 2011, at 12:26 PM, Moch Ramis wrote: SQAlchemy 0.7.1 / pyscopg 2.2.4 / PostgreSQL 8.4 -- Hello everyone. I recently profiled a task that was making an abusive use of inserts and queries through

Re: [sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Moch Ramis
Thanks for your fast answer. 2011/6/30 Michael Bayer mike...@zzzcomputing.com This looks like you have 49000 calls to session.commit(), so, depending on what you're doing, I'd reduce the number of commit calls down to one, after the entire series of insert operations is complete.

Re: [sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Michael Bayer
On Jun 30, 2011, at 1:01 PM, Moch Ramis wrote: Thanks for your fast answer. 2011/6/30 Michael Bayer mike...@zzzcomputing.com This looks like you have 49000 calls to session.commit(), so, depending on what you're doing, I'd reduce the number of commit calls down to one, after the entire

[sqlalchemy] Re: Slightly confusing error when session set up incorrectly

2011-06-30 Thread Ben Sizer
On Jun 29, 7:30 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 29, 2011, at 12:24 PM, Ben Sizer wrote: OK, this happens a lot with me, if anyone can please recommend what university I should go to in order to learn to speak english correctlyHere's the sentence: It's not

[sqlalchemy] Re: How to get setter-like behaviour universally across a custom type? (with UTC DateTime examples)

2011-06-30 Thread Russ
I've added an example for you as well as Jason who asked almost the same question earlier, which illustrates the TypeDecorator in conjunction with an attribute listener that is applied to all occurrences of the target type, an approach also used by the mutable attributes extension, and