[sqlalchemy] Re: the return type of conn.execute(text())

2009-01-28 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha Sent: 27 January 2009 22:41 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] the return type of conn.execute(text()) Hi, Today I attempted to serialize

[sqlalchemy] Re: the return type of conn.execute(text())

2009-01-28 Thread MikeCo
Doesn't this work? result = conn.execute('some select statement').fetchall() result will be a ResultProxy containing RowProxy's pickleable = [tuple(row) for row in result] Each tuple contains the column data in what should be a pickleable form. This will work for ints, strings, unicodes, etc.

[sqlalchemy] autoflush during instanciation

2009-01-28 Thread GustaV
Hi all, In the __init__ method of a mapper, the load of a relation may lead to an autoflush operation. When it happens, the object being instanciated is already in the session and so INSERTed in the flush, whereas it is not initialised completly (still in __init__). It may throw exceptions for

[sqlalchemy] Re: autoflush during instanciation

2009-01-28 Thread Michael Bayer
On Jan 28, 10:45 am, GustaV buisson.guilla...@gmail.com wrote: Hi all, In the __init__ method of a mapper, the load of a relation may lead to an autoflush operation. When it happens, the object being instanciated is already in the session and so INSERTed in the flush, whereas it is not

[sqlalchemy] Re: autoflush during instanciation

2009-01-28 Thread GustaV
I'm using Declarative extension actually. In the pylons framework, the session initialise like this def init_model(engine): Call me before using any of the tables or classes in the model sm = orm.sessionmaker(autoflush=True, autocommit=False, bind=engine) meta.engine = engine

[sqlalchemy] Article about Elixir/SQLAlchemy in Python Magazine

2009-01-28 Thread Gaetan de Menten
Hi all, For those who might be interested, I wrote an article for Python Magazine titled Creating a collection manager with Elixir. It has just been published in the January issue (http://www.pythonmagazine.com/c/issue/view/90). Within the article, I detail the creation of a simple collection

[sqlalchemy] Re: autoflush during instanciation

2009-01-28 Thread Michael Bayer
On Jan 28, 2009, at 11:21 AM, GustaV wrote: I'm using Declarative extension actually. In the pylons framework, the session initialise like this def init_model(engine): Call me before using any of the tables or classes in the model sm = orm.sessionmaker(autoflush=True,

[sqlalchemy] Re: Mixing synonyms and properties with reflected tables..

2009-01-28 Thread Michael Bayer
On Jan 27, 2009, at 9:49 AM, Toby Bradshaw wrote: Paragraph 1: Set up name as a synonym to another mapped property. Paragraph 4: name refers to the name of the existing mapped property, which can be any other MapperProperty including column-based properties and relations. Paragraph 1

[sqlalchemy] Lazy load issue when using declarative_base methodology?

2009-01-28 Thread Gloria W
This is a strange problem. I'd appreciate any assistance. I have a class set up using the declarative_bass model, set up in this way: member_profile_table = MemberProfile.__table__ metdata = Base.metadata engine = create_engine(config.db_conn) Session = sessionmaker(bind=engine)

[sqlalchemy] Re: Lazy load issue when using declarative_base methodology?

2009-01-28 Thread az
typo - 81087 and 18087? maybe run with echo=True and see what goes on? does the testfile use same engine/.. setup as below? On Wednesday 28 January 2009 19:21:54 Gloria W wrote: This is a strange problem. I'd appreciate any assistance. I have a class set up using the declarative_bass model,

[sqlalchemy] Re: Lazy load issue when using declarative_base methodology?

2009-01-28 Thread Gloria W
echo=True showed me them issue! It was a silly transposition. Thanks for this bit of help. I have been staring at this test code for so long, I could not see this issue. On Jan 28, 12:44 pm, a...@svilendobrev.com wrote: typo - 81087 and 18087? maybe run with echo=True and see what goes on?

[sqlalchemy] Re: cascade=all, delete, delete-orphan causes insert to fail

2009-01-28 Thread Michael Bayer
use all, delete cascade but not delete-orphan. On Jan 28, 1:06 pm, Gloria W strang...@comcast.net wrote: Hi again, I have a problem with a cascade relation. Any help or clues would be greatly appreciated. I have a model which has this relation:  member =

[sqlalchemy] joining to child, and using child in relation

2009-01-28 Thread GHZ
I have a subscriber and address table. a subscriber will have one and only one 'MAIN' address. I want the subscriber and MAIN address to be represented by one class 'Subscriber'. However, I want that class to have a collection 'addresses' which contains other addresses (e.g. old addresses) -

[sqlalchemy] Re: joining to child, and using child in relation

2009-01-28 Thread Michael Bayer
a join is of the form: table1.join(table2, onclause) such as subscriber_table.join(address_table, and_(address_table.c.subscriber_id==subscriber.c.id, address_table.c.type=='MAIN')) but unfortunately current relation() code does not support a join of X/ Y to Y, unless the join of

[sqlalchemy] delete failure with foreign key relations

2009-01-28 Thread n00b
back again, sorry. i specified a model with a few one-to-many and one many-to-many relations using SA 0.51 in MySql 5.1.25 rc; tables are all INNODB. all works well and as expected in the ORM realm. however, when i'm trying to use SQL Expression for a delete (row) operation, i get the dreaded

[sqlalchemy] Re: joining to child, and using child in relation

2009-01-28 Thread Michael Bayer
OK, well that was painful but we are stronger for the effort, thanks for bringing up the issue. r5740 of trunk will allow your original mapper(A.join(B))-mapper(B) to configure properly. On Jan 28, 2009, at 11:28 PM, Michael Bayer wrote: a join is of the form: table1.join(table2,