Re: [sqlalchemy] session usage lifecycle

2010-04-19 Thread Chris Withers
Michael Bayer wrote: On Mar 12, 2010, at 6:54 AM, Chris Withers wrote: Got this error this morning: File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.8-py2.5.egg/sqlalchemy/orm/session.py, line 247, in _assert_is_active The transaction is inactive due to a rollback in a

[sqlalchemy] another confusing error message

2010-04-19 Thread Chris Withers
Michael Bayer wrote: On Mar 12, 2010, at 6:54 AM, Chris Withers wrote: Got this error this morning: File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.8-py2.5.egg/sqlalchemy/orm/session.py, line 247, in _assert_is_active The transaction is inactive due to a rollback in a

RE: [sqlalchemy] Is the mapper must have a primary_key?

2010-04-19 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Gaicitadie Sent: 16 April 2010 20:06 To: sqlalchemy Subject: [sqlalchemy] Is the mapper must have a primary_key? #!/usr/bin/python # -*- coding: UTF-8 -*- from sqlalchemy

Re: [sqlalchemy] SQLAlchemy 0.6.0 released

2010-04-19 Thread Chris Withers
Michael Bayer wrote: The first official 0.6 release of SQLAlchemy is now available. Yay! Congrats :-) Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- You received this message because you are subscribed to the

[sqlalchemy]why I can't use custom type by form_statement method??

2010-04-19 Thread Rita Liang
I have a custom type NormalDate which uses to convert Integer Date type to String Date type. but when I use form_statement to query the date.it did't work! however,it will work, if I use a query method... for example. crew = query.from_statement(SELECT * from crew_member where +

Re: [sqlalchemy] case sensitive Unicode and String columns

2010-04-19 Thread Chris Withers
Michael Bayer wrote: the MySQL string types support MySQL's collation flags so you can get close to it for at least that platform. But then you aren't platform independent. Not sure why you're so averse to creating types. The interface could not be simpler. When i used Hibernate, there was

Re: [sqlalchemy] case sensitive Unicode and String columns

2010-04-19 Thread Michael Bayer
On Apr 19, 2010, at 12:51 PM, Chris Withers wrote: Michael Bayer wrote: the MySQL string types support MySQL's collation flags so you can get close to it for at least that platform. But then you aren't platform independent. Not sure why you're so averse to creating types. The interface

[sqlalchemy] model validation library, need help with extension sequencing

2010-04-19 Thread Randy Syring
I am developing a library to do Active Record style validations on SA declarative instances: http://bitbucket.org/rsyring/sqlalchemy-validation/src/tip/savalidation/ I know there are differences of opinion on the value of doing validation like this, but I am really hoping to avoid that

Re: [sqlalchemy] model validation library, need help with extension sequencing

2010-04-19 Thread Michael Bayer
On Apr 19, 2010, at 3:25 PM, Randy Syring wrote: * I would like default values to have been applied to the instance if applicable before validation, i.e. i want to see the instance as a mirror of what the flushed SQL will look like * I would like to be able to have multiple models fail

Re: [sqlalchemy] Re: model validation library, need help with extension sequencing

2010-04-19 Thread Randy Syring
Ok, so I thought I might sacrifice getting all errors at once fore being able to validate default values, by using the mapper extension's before_update() and before_insert(). However, that also does not seem to work as the Column's default values are not applied at that point either.

Re: [sqlalchemy] Re: model validation library, need help with extension sequencing

2010-04-19 Thread Michael Bayer
On Apr 19, 2010, at 3:43 PM, Randy Syring wrote: Mike, Thank you for your quick reply. If I understand correctly, after_flush() will get called after the SQL is actually sent to the db server. If that is the case, then it is too late for this validation as I would want the ability to

Re: [sqlalchemy]why I can't use custom type by form_statement method??

2010-04-19 Thread Michael Bayer
use a text() construct as the argument to your from_statement() call, and specify a typemap of {'birthday':NormalDate} along with it. http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=text#sqlalchemy.sql.expression.text On Apr 19, 2010, at 5:38 AM, Rita Liang

[sqlalchemy] Relationships in an inheritance heirarchy

2010-04-19 Thread Nickle
I have the following python classes. class Instrument (object): def __init__ (self, name): self.name = name class Equity (Instrument): def __init__ (self, name, currency_id): Instrument.__init__(self, name) self.currency_id = currency_id class Currency

Re: [sqlalchemy] Relationships in an inheritance heirarchy

2010-04-19 Thread Conor
Nickle wrote: I have the following python classes. class Instrument (object): def __init__ (self, name): self.name = name class Equity (Instrument): def __init__ (self, name, currency_id): Instrument.__init__(self, name) self.currency_id = currency_id

[sqlalchemy] Re: Is the mapper must have a primary_key?

2010-04-19 Thread Gaicitadie
Thank you very much, I understand it from now on On 4月19日, 下午4时55分, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Gaicitadie Sent: 16 April 2010 20:06 To: sqlalchemy