[sqlalchemy] Re: one to many relation, removing and adding list issue

2010-08-26 Thread fma
Any suggestion helping solving this? On 25 août, 13:02, Martin-Leon Francois francois@gmail.com wrote: Hi, I am trying in the same  session to detach an instance from a collection ( one to many) flush and commit everything (all is ok) and then attach the removed instance   again.

[sqlalchemy] Re: TypeDecorator Problem with basic association pattern

2010-08-26 Thread Frank
Hi Michael, yes, you're right of course. This overlapped with the other issue you mentioned about the nutrient_weight/weight column name. I didn't realize this at once. When I change the column name or the mapping appropriately I don't need to return None anymore. Thanks again Frank -- You

Re: [sqlalchemy] .info dict on Column

2010-08-26 Thread Alessandro Dentella
On Tue, Aug 24, 2010 at 02:48:37PM -0400, Michael Bayer wrote: Info option is clearly very handy. At the moment I implemented an image field in sqlkit, (that's just a bunch of handler in the gui). In order to do that I used a type inherited with no addition, just to understand that that

Re: [sqlalchemy] Re: one to many relation, removing and adding list issue

2010-08-26 Thread Martin-Leon Francois
hi, The problem seems to be a little bit more general, I have a unique class (doing nothing) mapped to a unique table. After opening a session, I create an instance, add it to the session, flush, commit. Everything is ok. -- a row in the table, instance in the identity_map of the session

Re: [sqlalchemy] .info dict on Column

2010-08-26 Thread Michael Bayer
On Aug 26, 2010, at 5:09 AM, Alessandro Dentella wrote: On Tue, Aug 24, 2010 at 02:48:37PM -0400, Michael Bayer wrote: Info option is clearly very handy. At the moment I implemented an image field in sqlkit, (that's just a bunch of handler in the gui). In order to do that I used a type

[sqlalchemy] Re: one to many relation, removing and adding list issue

2010-08-26 Thread fma
Sorry if you receive this twice, I am not sure if it had been correctly posted. On 26 août, 14:49, Martin-Leon Francois francois@gmail.com wrote: hi, The problem seems to be a little bit more general, I have a unique class (doing nothing) mapped to a unique table. After opening a

Re: [sqlalchemy] Re: one to many relation, removing and adding list issue

2010-08-26 Thread Michael Bayer
On Aug 26, 2010, at 8:49 AM, Martin-Leon Francois wrote: hi, The problem seems to be a little bit more general, I have a unique class (doing nothing) mapped to a unique table. After opening a session, I create an instance, add it to the session, flush, commit. Everything is ok. -- a

[sqlalchemy] hot to get connection pool from engine?

2010-08-26 Thread keekychen.shared
Dear All, After I read SQLAlchemy;s FAQ I think below code may works, import sqlalchemy.pool as pool import sqlite3 as sqlite3 conn_proxy = pool.manage(sqlite3) # then connect normally connection = conn_proxy.connect(...) however I also get below snippets: engine = create_engine(...)

Re: [sqlalchemy] Re: one to many relation, removing and adding list issue

2010-08-26 Thread Martin-Leon Francois
ok, many thx fma Le 26 août 2010 à 17:03, Michael Bayer a écrit : On Aug 26, 2010, at 8:49 AM, Martin-Leon Francois wrote: hi, The problem seems to be a little bit more general, I have a unique class (doing nothing) mapped to a unique table. After opening a session, I create an

Re: [sqlalchemy] one to many relation, removing and adding list issue

2010-08-26 Thread Michael Bayer
On Aug 25, 2010, at 7:02 AM, Martin-Leon Francois wrote: assert(len(o1.to_many) == 2) #this assert fails why? OK so as of r2e09679be06b, your original test now returns: sqlalchemy.exc.InvalidRequestError: Instance 'Many at 0x12922f0' has been deleted. Use the make_transient() function to

[sqlalchemy] reflected column spec doesn't match model column spec

2010-08-26 Thread Chris Withers
Hi All, For the following model: class Header(Base): __tablename__ = 'header' id = Column(Integer, primary_key=True) message_id = Column(Integer,ForeignKey('message.id')) name = Column(String(50)) value = Column(Text(255)) sqlalchemy-migrate's SchemaDiff tool against the

[sqlalchemy] how to get connection pool from engine?

2010-08-26 Thread keekychen.shared
Sorry for last mail, I clicked send without spell check, so it may cause confuse, pls ignore last mail. = Dear All, After I read SQLAlchemy's FAQ I think below code may works, import sqlalchemy.pool as pool import sqlite3 as sqlite3 conn_proxy = pool.manage(sqlite3) # then

Re: [sqlalchemy] reflected column spec doesn't match model column spec

2010-08-26 Thread Michael Bayer
On Aug 26, 2010, at 11:42 AM, Chris Withers wrote: Hi All, For the following model: class Header(Base): __tablename__ = 'header' id = Column(Integer, primary_key=True) message_id = Column(Integer,ForeignKey('message.id')) name = Column(String(50)) value =

[sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Alessandro Dentella
Hi again, sorry for flooding with email this week... I stumbled on the CircularDependencyError in some occasions with self referencing models. I do understand that it can be tricky to INSERT and DELETE but I'm just updating rows. I reduced my problem to the bare minimum. It works both on 0.5.8

Re: [sqlalchemy] reflected column spec doesn't match model column spec

2010-08-26 Thread Chris Withers
Michael Bayer wrote: How can it be changed so that the column reflected from the DB and the column calculated from the model end up being the same? if schemas are being diffed, types can be compared generically using type affinity. This is described at:

Re: [sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Michael Bayer
need a full test case. Here's yours, runs fine: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import * from sqlalchemy.types import * from sqlalchemy.orm import * Base = declarative_base() e = create_engine('sqlite://', echo=True) Base.metadata.bind = e sess =

Re: [sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Michael Bayer
of course you'll get a cycle if you do this, though: s1 = School(cod=S1, cod_riferimento=S1, cliente=False) d1 = School(cod=D1, cod_riferimento=S1, cliente=False) s1.sedi = [s1, d1] s1-s1 is not supported by self referential flushes, unless you put post_update=True on the relation() you have

Re: [sqlalchemy] reflected column spec doesn't match model column spec

2010-08-26 Thread Michael Bayer
On Aug 26, 2010, at 12:15 PM, Chris Withers wrote: Michael Bayer wrote: How can it be changed so that the column reflected from the DB and the column calculated from the model end up being the same? if schemas are being diffed, types can be compared generically using type affinity. This

[sqlalchemy] Change echo at will

2010-08-26 Thread Michael Hipp
Is there a way to set 'echo' at any time? Everything I can find sets it when the engine is created and doesn't seem to change it afterward. Thanks, Michael -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: problem with relationships with a postgres schema using declarative mapping

2010-08-26 Thread Nigel
I think where I'm getting bogged down with the case I have (most likely because I'm new to relational mapping of db tables anyway) is how I get data into the intermediate table. What I'm doing here is setting up a dependency graph where that entityConnections table needs to have data explicitly

Re: [sqlalchemy] Change echo at will

2010-08-26 Thread Mike Conley
On Thu, Aug 26, 2010 at 4:21 PM, Michael Hipp mich...@hipp.com wrote: Is there a way to set 'echo' at any time? Everything I can find sets it when the engine is created and doesn't seem to change it afterward. Thanks, Michael You can assign the engine.echo property to True or False any

Re: [sqlalchemy] how to do housekeeping jobs before using sqlalchemy and coworking with python sqlite3 and sqlalchemy ?

2010-08-26 Thread Mike Conley
On Wed, Aug 25, 2010 at 1:30 PM, keekychen.shared keekychen.sha...@gmail.com wrote: How to test if an existing database file is a valid sqlite3 format file before using sqlalchemy? Here is function we use import os, os.path as osp try: from pysqlite2 import dbapi2 as sqlite except:

[sqlalchemy] self referencing column

2010-08-26 Thread waugust
I've been looking through the documentation and I could have sworn I saw it before but It seem I can't find it once more... I'm looking for how to set up a self referencing column like in this pseudo scenerio: class Action(DeclarativeBase): __tablename__ = 'action' id =

[sqlalchemy] Re: self referencing column

2010-08-26 Thread waugust
I'm guessing that the answer would be as at: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DeclarativeSelfReferencingTable ? On Aug 26, 8:02 pm, waugust waugustyn...@gmail.com wrote: I've been looking through the documentation and I could have sworn I saw it before but It seem I can't find

Re: [sqlalchemy] Re: self referencing column

2010-08-26 Thread Alexandre Conrad
This is the documentation for self referential mapper: http://www.sqlalchemy.org/docs/mappers.html#adjacency-list-relationships I guess you have found the recipes for doing it the declarative way. 2010/8/26 waugust waugustyn...@gmail.com: I'm guessing that the answer would be as at:

Re: [sqlalchemy] Re: self referencing column

2010-08-26 Thread Wojtek Augustynski
Thanks, though! :) Don't suppose you would have an idea on how I could store a procedure? :) the actions to which I'm pertaining I envisioned as controller actions (Pylons) that I could define an associate with an execution flow... (don't know if that makes sense)... I was thinking of just