[sqlalchemy] Re: DB Operational Error

2008-11-04 Thread Raoul Snyman
Hi Michael, On Nov 2, 1:07 am, Michael Bayer [EMAIL PROTECTED] wrote: look into the pool_recycle option described athttp://www.sqlalchemy.org/docs/05/dbengine.html I'm also getting these errors, and I have pool_recycle, pool_size and max_cycle set. I'm using Pylons, SQLAlchemy 0.5 and

[sqlalchemy] Re: DB Operational Error

2008-11-04 Thread [EMAIL PROTECTED]
On Nov 4, 3:36 am, Raoul Snyman [EMAIL PROTECTED] wrote: Hi Michael, On Nov 2, 1:07 am, Michael Bayer [EMAIL PROTECTED] wrote: look into the pool_recycle option described athttp://www.sqlalchemy.org/docs/05/dbengine.html I'm also getting these errors, and I have pool_recycle,

[sqlalchemy] proposed extension to SessionExtension: after_bulk_operation

2008-11-04 Thread Martijn Faassen
Hi there, I've been using zope.sqlalchemy's integration with SQLALchemy and it's been working pretty well so far. Today however I ran into a snag when using session.query(..).delete(). While a query immediately after the delete showed no more objects, in the next transaction the objects

[sqlalchemy] foreign key reference between the models of two different TurboGears projects?

2008-11-04 Thread JV
Hi How can I have a foreign key reference between the models of two different TurboGears projects? I am using sqlalchemy. JV --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: DB Operational Error

2008-11-04 Thread Michael Bayer
the MySQL has gone away error usually corresponds to a connection thats been held open without activity for 8 hours. if thats not the case here, either the MySQL client config has the timeout turned way down or something is broken at the network level. im not sure if by isolated

[sqlalchemy] Re: Sharding with 2 pools of connections

2008-11-04 Thread Michael Bayer
On Nov 4, 2008, at 4:10 PM, Lenn0x wrote: Hi I have 2 sessions created: a_engine = create_engine('mysql:///host1', echo=True) a_session = scoped_session(sessionmaker(autoflush=True, transactional=True, bind=a_engine)) b_engine = create_engine('mysql:///host2', echo=True) b_session =

[sqlalchemy] extending pre-existing (read only) tables

2008-11-04 Thread rdmurray
I've got a somewhat oddball situation, and I'm hoping for some pointers to the right sqlalchemy features to handle this. Or, failing that, hints as to the places I'm going to need to write code to compensate for the weirdness I have to deal with. The situation is that I get periodic copies of a

[sqlalchemy] Re: single table inheritance mapping

2008-11-04 Thread David Gardner
Maybe I did something wrong so loosely following the example http://techspot.zzzeek.org/?p=4 which I realize is a bit old now. I was able to get my basic mappers setup and working. class NodeLoader(MapperExtension): def create_instance(self, mapper, selectcontext, row, class_):

[sqlalchemy] Re: Composite columns with declarative base

2008-11-04 Thread Ritesh Nadhani
Unfortunately, it still gives me an error. http://paste.pocoo.org/show/90191 Did I miss something? PS: I added the __get__ method just for the fun of it, I have no idea what it does. Looking at the docs:

[sqlalchemy] Re: Sharding with 2 pools of connections

2008-11-04 Thread Lenn0x
After pondering this for awhile, I think the easiest solution would be to do this: 1. Have it connect to a hardware vip that manages failovers etc to my 2 servers. 2. Have 1 dedicated pool, when the connect occurs on the vip, the vip will evenly distribute. 3. Set the pool to have idle recycle

[sqlalchemy] Re: Composite columns with declarative base

2008-11-04 Thread Michael Bayer
attached is a script illustrating the usage of comparable_property, in roughly the same way you were using composite earlier.from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.orm.interfaces import PropComparator from sqlalchemy.ext.declarative import declarative_base engine =

[sqlalchemy] Re: Composite columns with declarative base

2008-11-04 Thread Michael Bayer
also, I wonder how the way you were doing it before, with composite, was actually working out ? It wasn't intended to hold half of a primary key like that which is probably why I warned against it, but if its working for you, there's no reason not to use it. I.e. with declarative just put

[sqlalchemy] Re: foreign key reference between the models of two different TurboGears projects?

2008-11-04 Thread JV
Michael Can you elaborate a bit on how to do each of the thing you said - metadata sharing between 2 separate Turbogears projects and placing the actual column in the ForeignKey constructor, instead of string 'table.column.id'. I read your earlier discussion

[sqlalchemy] Re: foreign key reference between the models of two different TurboGears projects?

2008-11-04 Thread JV
I got a solution. Thanks to Michael. Here is what he suggested. * You use the Column object: from myproject.model import sometable someothertable = Table('someothertable', metadata, Column('foobar', Integer, ForeignKey(sometable.c.foobar)) as you can see the common theme in both cases