[sqlalchemy] Re: How to lock tables in mysql with SqlAlchemy?

2008-04-25 Thread Ting Zhou
jason kirtland 写道: Ting Zhou wrote: Dear All, I would like to lock a table like LOCK TABLES table_name in mysql command. How can I do that with SqlAlchemy. I have defined a class |//|//|class Pointer(Entity): using_options(tablename='Pointer',autosetup=True)

[sqlalchemy] help required urgent

2008-04-25 Thread sniffer
hi all this time i am in big trouble , i recently changed my job and on the new job was handed over project involving SA, i am a newbie as far as SA is concerned but have had little prior experience with it.my problem is as follows the project i have been handed was coded by someone before me it

[sqlalchemy] what happens on save?

2008-04-25 Thread Eric Lemoine
Hello I have the following code in my pylons app: refugee = Refugee(value, geometry) model.Session.save(refugee) model.Session.commit() Refugee is the class mapped to my Table object (refugees_table). geometry is an instance of a custom type, for which I created a Geometry(TypeEngine) class.

[sqlalchemy] Re: How to lock tables in mysql with SqlAlchemy?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 2:50 AM, Ting Zhou wrote: Thank you. This is what I am doing at the moment. I am hoping it can be done more pythonically. locking tables is a coarse grained action that can lead to deadlocks. Finer grained row locking is available using SELECT...FOR UPDATE which

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: In commit(), SQLAlchemy compares the geometry object to some other geometry object (yes, my Geometry class defines the compare_values method). I'd just like to know what object my geometry object is compared to? I'm just saving a new object

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: Hello I have the following code in my pylons app: refugee = Refugee(value, geometry) model.Session.save(refugee) model.Session.commit() Refugee is the class mapped to my Table object (refugees_table). geometry is an instance of a

[sqlalchemy] Re: generate_series?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 9:04 AM, Luke Iannini wrote: Hi all, Is there a way to use generate_series with SQLAlchemy? http://www.postgresql.org/docs/8.2/interactive/functions-srf.html generate_series = select([column('i')], from_obj=[func.generate_series(bindparam('start'),

[sqlalchemy] Getting the table name that a mapped object came from

2008-04-25 Thread TP
Hi, does anyone know a way to get the underlying table name from the DB for a mapped object? foo = session.Query(Foo).filter_by(a=x) I'd like to now find out what table name foo came from. Thanks! --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: Getting the table name that a mapped object came from

2008-04-25 Thread David Bonner
On Fri, Apr 25, 2008 at 2:34 PM, TP [EMAIL PROTECTED] wrote: Hi, does anyone know a way to get the underlying table name from the DB for a mapped object? foo = session.Query(Foo).filter_by(a=x) I'd like to now find out what table name foo came from. You'd want

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Eric Lemoine
On Fri, Apr 25, 2008 at 5:55 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: Hello I have the following code in my pylons app: refugee = Refugee(value, geometry) model.Session.save(refugee) model.Session.commit()

[sqlalchemy] Re: Getting the table name that a mapped object came from

2008-04-25 Thread TP
Thanks! On Apr 25, 2:44 pm, David Bonner [EMAIL PROTECTED] wrote: On Fri, Apr 25, 2008 at 2:34 PM, TP [EMAIL PROTECTED] wrote:  Hi, does anyone know a way to get the underlying table name from the  DB for a mapped object?  foo = session.Query(Foo).filter_by(a=x)  I'd like to now find

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Eric Lemoine
On Fri, Apr 25, 2008 at 8:48 PM, Eric Lemoine [EMAIL PROTECTED] wrote: On Fri, Apr 25, 2008 at 5:55 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 25, 2008, at 11:37 AM, Eric Lemoine wrote: Hello I have the following code in my pylons app: refugee

[sqlalchemy] Re: Can I get some help with this?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 4:20 PM, juju wrote: If this is the relation with its constraints: CREATE TABLE Orders (o_num INTEGER NOT NULL PRIMARY KEY, c_num INTEGER NOT NULL, s_num INTEGER DEFAULT 0 NOT NULL, o_date DATE NOT NULL, o_filled o_filled, CONSTRAINT fk_cnum FOREIGN KEY (c_num)

[sqlalchemy] Re: what happens on save?

2008-04-25 Thread Michael Bayer
On Apr 25, 2008, at 4:21 PM, Eric Lemoine wrote: Module sqlalchemy.orm.mapper:1198 in _postfetch elif not c.primary_key and c.key in params and self._get_state_attr_by_column(state, c) != params[c.key]: Module shapely.geometry.base:255 in __ne__ return not self.equals(other) Module

[sqlalchemy] problems with py2app

2008-04-25 Thread iain duncan
Hi folks, I seem to be having a problem with sqlalchemy and py2app, but I am very new to OS X and py2app, so I could be doing something stupid. When we try to build the app we get this: ImportError: No module named logging Traceback (most recent call last): File