[sqlalchemy] Re: Problems with composite primary key and nested relations

2009-08-03 Thread Christian Schwanke
Hi Michael, thanks for your effort, glad to hear that the issue is resolved! On 1 Aug., 02:37, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 31, 2009, at 7:20 PM, Michael Bayer wrote: I will investigate a way such that the dialect more intelligently selects the primary key column

[sqlalchemy] Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
Hi, Does accessing a backref always have to issue SQL, even if the object to be loaded already exists in the identity map? For example, if I have a many-to-one lazy-loaded relationship from Master to Detail with a backref, the statement master.details[0].master will issue SQL for the '.master'

[sqlalchemy] Re: Thread problem

2009-08-03 Thread drakkan
Thanks I defined scoped session the wrong way: engine = create_engine(connectionstring, echo=settings.DEBUG, echo_pool=settings.DEBUG, pool_size=20, max_overflow=400) session = scoped_session(sessionmaker(bind=engine)) s=session() instead of: engine =

[sqlalchemy] Re: Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
I wrote: Hi, Does accessing a backref always have to issue SQL, even if the object to be loaded already exists in the identity map? For example, if I have a many-to-one lazy-loaded relationship from Master to Detail with a backref, the statement master.details[0].master will issue SQL

[sqlalchemy] loading just the ids of a related object

2009-08-03 Thread sammyt123
Hello, I am having trouble getting just the data I need from a query. I have a one-to-many relationship between two classes Content and Section, such that one Content has many Sections. I want to retrieve a (or many) content object and populate on it a property called section_ids which will be

[sqlalchemy] Unnecessary join in eager one-to-many backref

2009-08-03 Thread Martin Stein
Hi everybody, In my db-setup, there is a one-to-many relationship with a backref that is configured for eager loading (not the relation but the backref!). When I access the child objects of the parent object, the query from sqlalchemy joins back to the parent object (due to eager loading). In

[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'dict'

2009-08-03 Thread Michael Bayer
rajasekhar911 wrote: the error can be reproduced by adding __getattr__ method to the model class. my model class has some attributes that are lazy initialized and are not mapped to any table columns. i am using the getattr method to implement the lazy initialization. can you send a full

[sqlalchemy] Re: Backrefs and the identity map

2009-08-03 Thread Michael Bayer
King Simon-NFHD78 wrote: to master_id = sa.Column(sa.Integer, sa.ForeignKey(Master.__table__.c.id)) ...and now it seems to work! So is this a bug? yes, that would be a bug. There are some other scenarios where this kind of thing occurs (lazy clause doesn't optimize) related to

[sqlalchemy] Re: Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
Michael Bayer wrote: King Simon-NFHD78 wrote: to master_id = sa.Column(sa.Integer, sa.ForeignKey(Master.__table__.c.id)) ...and now it seems to work! So is this a bug? yes, that would be a bug. There are some other scenarios where this kind of thing occurs (lazy clause

[sqlalchemy] Re: Unnecessary join in eager one-to-many backref

2009-08-03 Thread Michael Bayer
Martin Stein wrote: Hi everybody, In my db-setup, there is a one-to-many relationship with a backref that is configured for eager loading (not the relation but the backref!). When I access the child objects of the parent object, the query from sqlalchemy joins back to the parent object (due

[sqlalchemy] Re: Cloning an instance of a mapped class

2009-08-03 Thread BigJon
On Jul 29, 1:43 pm, Mike Conley mconl...@gmail.com wrote: I have a need to clone an instance of a mapped class and insert the new instance in my database with only minor changes to attributes. To do this I want to create a new instance of the class with all non-key attributes copied from the

[sqlalchemy] join + filter

2009-08-03 Thread thatsanicehatyouhave
Hi, I'm circling around an answer for a problem but am not quite getting it. I have two tables: Plugging and Cartridge. Plugging has a to-one relation to Cartridge, and the inverse relation is to-many. Cartridge has a field called number and plugging has a field called active. I want to

[sqlalchemy] Advice on modeling a many-to-many relationship

2009-08-03 Thread Hollister
I have 2 tables which are related to each other through an M:N relationship (Keyword Action). Additionally, the relationship itself has attributes, which I have as non-key attributes in a third table (KeywordAction). I've modeled this dozens of different ways, but have yet to get exactly what I

[sqlalchemy] Declarative base and Adjacency List Relationships

2009-08-03 Thread maxi
Hi, I´ve just using sqlalchemy 0.5.1 with python 2.6 and turbogers, but I found a little problem trying to configurate adjacency relationship with declarative base. My object class is something like this: class QueryGroup(DeclarativeBase): __tablename__ = 'queries_group' qry_grp_id =

[sqlalchemy] IronPython

2009-08-03 Thread Paul Hemans
Does anyone have any experience with SQLalchemy on IronPython? I was considering using it as part of a platform and would like to find out if there are problems before I got in too deep. Thanks --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: IronPython

2009-08-03 Thread Philip Jenvey
On Aug 3, 2009, at 4:37 PM, Paul Hemans wrote: Does anyone have any experience with SQLalchemy on IronPython? I was considering using it as part of a platform and would like to find out if there are problems before I got in too deep. There's the thread linked from here:

[sqlalchemy] Table.drop() vs. MetaData.remove()

2009-08-03 Thread Bret Aarden
I used a Table's drop() method to drop it from the database. In order to create a new version of the table, I found I was forced to also separately use its MetaData's remove() method to delete the Table. I didn't find this documented anywhere. Is this preferred behavior? It seems like dropping a

[sqlalchemy] Re: Table.drop() vs. MetaData.remove()

2009-08-03 Thread Michael Bayer
On Aug 3, 2009, at 7:08 PM, Bret Aarden wrote: I used a Table's drop() method to drop it from the database. In order to create a new version of the table, I found I was forced to also separately use its MetaData's remove() method to delete the Table. I didn't find this documented anywhere.

[sqlalchemy] Re: join + filter

2009-08-03 Thread Michael Bayer
this is standard relation() stuff thats documented in the ORM tutorial in Querying with Joins. On Aug 3, 2009, at 4:59 PM, thatsanicehatyouh...@mac.com wrote: Hi, I'm circling around an answer for a problem but am not quite getting it. I have two tables: Plugging and Cartridge. Plugging

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-03 Thread Michael Bayer
On Aug 3, 2009, at 5:21 PM, Hollister wrote: I have 2 tables which are related to each other through an M:N relationship (Keyword Action). Additionally, the relationship itself has attributes, which I have as non-key attributes in a third table (KeywordAction). I've modeled this dozens of