[sqlalchemy] Simple question about delete-orphan

2011-11-01 Thread Michael Naber
Quick question: Why am I allowed to persist an address with no person_id? Shouldn't the delete-orphan prohibit this? Thanks, Michael from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import

[sqlalchemy] multiple insert or update

2011-11-01 Thread Paul
What's the cleanest way to perform a multiple insert or update? ie, if the record already exists an update operation is performed or if not an insert is performed. I have seen merge being recommended for this insert or update, but I wondered if this was available as a multiple call like

[sqlalchemy] how can i detect fields that cause an exception ?

2011-11-01 Thread Tate Kim
hi, I'm using sqlalchemy 0.7.3 and postgresql 9 with psycopg2 and python 2.7. When I put wrong type of data(ex: 'some string' into Integer field), I get DataError exception in commit phase. This is so expected result, but i think it would be great to get more specific data which can tell

Re: [sqlalchemy] Simple question about delete-orphan

2011-11-01 Thread Michael Bayer
On Nov 1, 2011, at 6:48 AM, Michael Naber wrote: Quick question: Why am I allowed to persist an address with no person_id? Shouldn't the delete-orphan prohibit this? This was the behavior up until 0.7, when the decision was reversed - delete-orphan now considers an orphan to be only an

Re: [sqlalchemy] multiple insert or update

2011-11-01 Thread Michael Bayer
On Nov 1, 2011, at 7:23 AM, Paul wrote: What's the cleanest way to perform a multiple insert or update? ie, if the record already exists an update operation is performed or if not an insert is performed. that's a funny usage of terminology - a multiple insert would normally be construed

Re: [sqlalchemy] how can i detect fields that cause an exception ?

2011-11-01 Thread Michael Bayer
DataError is a psycopg2 exception. psycopg2 in turn is doing what PG's client API provides for them. So if you wanted those messages to name the column that's the target of an INSERT or UPDATE you'd have to look into improving psycopg2 and/or how Postgresql's client system works. Normally,

[sqlalchemy] Re: multiple insert or update

2011-11-01 Thread Paul
Michael Bayer mike_mp at zzzcomputing.com writes: On Nov 1, 2011, at 7:23 AM, Paul wrote: What's the cleanest way to perform a multiple insert or update? ie, if the record already exists an update operation is performed or if not an insert is performed. that's a funny usage of

Re: [sqlalchemy] how can i detect fields that cause an exception ?

2011-11-01 Thread Tate Kim
I've got an idea from your answer. Thank you. -Original Message- From: Michael Bayer mike...@zzzcomputing.com Sender: sqlalchemy@googlegroups.com Date: Tue, 1 Nov 2011 11:15:03 To: sqlalchemy@googlegroups.com Reply-To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] how can i

Re: [sqlalchemy] Re: multiple insert or update

2011-11-01 Thread Michael Bayer
On Nov 1, 2011, at 11:25 AM, Paul wrote: Michael Bayer mike_mp at zzzcomputing.com writes: On Nov 1, 2011, at 7:23 AM, Paul wrote: What's the cleanest way to perform a multiple insert or update? ie, if the record already exists an update operation is performed or if not an insert

[sqlalchemy] association proxy not persisting?

2011-11-01 Thread Wichert Akkerman
I am fighting a bit of an odd issue (using SQLAlchemy 0.7.3). I have an account class, where each account has a list of strings managed via an association proxy. For a reason I can't seem to find the values are not persisted. The test case below demonstrates this: SQLAlchemy prints a Object of

Re: [sqlalchemy] association proxy not persisting?

2011-11-01 Thread Michael Bayer
you've removed the save-update cascade which is why Specialism doesn't get into the Session.the warning there is a new thing to give you a heads up on that fact (I get it for the add message).cascade should be all, delete, delete-orphan here. On Nov 1, 2011, at 11:39 AM, Wichert

Re: [sqlalchemy] Debugging 'StatementError: Can't reconnect until invalid transaction is rolled back' error

2011-11-01 Thread Benjamin Sims
Thanks for this. As an update, I put in code that notifies me when an error occurs. The real cause of this seems to still be the 'MySQL has gone away' error. This occurs in various places, always as the first DB call in a request (obviously). Is my understanding correct that in order to solve

Re: [sqlalchemy] Debugging 'StatementError: Can't reconnect until invalid transaction is rolled back' error

2011-11-01 Thread Michael Bayer
On Nov 1, 2011, at 5:49 PM, Benjamin Sims wrote: Thanks for this. As an update, I put in code that notifies me when an error occurs. The real cause of this seems to still be the 'MySQL has gone away' error. This occurs in various places, always as the first DB call in a request

[sqlalchemy] sqlalchemy-migrate 0.7.2 released

2011-11-01 Thread Jan Dittberner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello, thanks to the work of a lot of contributors I can announce the new release 0.7.2 of sqlalchemy-migrate today. The release is available at PyPI and our project page [1]. Starting with this release we use readthedocs.org to provide you with

Re: [sqlalchemy] sqlalchemy-migrate 0.7.2 released

2011-11-01 Thread Michael Bayer
congrats on your release ! and on getting all those contributors ! On Nov 1, 2011, at 7:06 PM, Jan Dittberner wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello, thanks to the work of a lot of contributors I can announce the new release 0.7.2 of sqlalchemy-migrate today.