[sqlalchemy] Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Tefnet Developers
Hello, I am having a problem here - at one point a one-to-many relation attribute is not in sync with a backref one (http://dpaste.com/104225/): # Fails with Python-2.5.4 and SQLAlchemy-0.5.5 or SQLAlchemy-rel_0_5 rev 6312 import sqlalchemy import sqlalchemy.ext.declarative class

[sqlalchemy] Re: Update primary key with inheritance

2009-10-08 Thread Marble
Can someone help me to get this right? this is ticket 1362 and is a TODO:http://www.sqlalchemy.org/trac/ticket/1362. My fault, I should have checked the tickets before posting. For now you need to issue update() statements for the tables manually,then reload your objects. Waiting for

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Christoph Zwerschke
Tefnet Developers schrieb: I am having a problem here - at one point a one-to-many relation attribute is not in sync with a backref one (http://dpaste.com/104225/): I can reproduce this and also like to know whether this is a bug or simply not supported by the default list instrumentation.

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Tefnet Developers
Dnia 2009-10-08, czw o godzinie 13:49 +0200, Christoph Zwerschke pisze: By the way, you don't need to use a meta class in your example; you can simply set manager = sqlalchemy.orm.relation( 'Employee', backref='subordinates', remote_side=Id) I needed it for other stuff so

[sqlalchemy] Attribute on Parent as dict of lists using middleman table attribute as key

2009-10-08 Thread tote
My question is about SQLAlchemy but I'm having troubles explaining it in words so I figured I explain it with a simple example of what I'm trying to achieve: parent = Table('parent', metadata, Column('parent_id', Integer, primary_key=True), Column('name', Unicode), )

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Michael Bayer
Tefnet Developers wrote: SteveBallmer = Employee(name = 'Steve Ballmer') CraigMundie = Employee(name = 'Craig Mundie') BillGates = Employee(name = 'Bill Gates') CraigMundie.manager = BillGates SteveBallmer.subordinates = [CraigMundie] print CraigMundie.manager: %s % (CraigMundie.manager)

[sqlalchemy] Re: relations with additional criteria

2009-10-08 Thread Martijn Faassen
Hey, Michael Bayer wrote: [snip] For the next go-around here, assuming this is all still not working for you can you please provide an example of what the additional filter does exactly ? Oh, it was already working for me (with the hack as described with backref and such, earlier in

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Tefnet Developers
Dnia 2009-10-08, czw o godzinie 09:59 -0400, Michael Bayer pisze: Is this a SQLAlchemy bug or my mistake? Backrefs deal with the two-way relation between A-B, but the event does not propagate in most cases to C or beyond, i.e. A-B-C where B is attached to A would indicate C-B becomes

[sqlalchemy] Execution of stored procedure on SQL Server 2008

2009-10-08 Thread Nicol van der Merwe
Greetings all I have spent almost two days trying to figure this out, so I hope somebody can help me. Platform info: Python 2.5.4 Operating system : Windows XP Database : SQL Server 2008 running on Windows server 2008. sqlAlchemy 0.5.6 using sqlSoup and pyODBC version 2.1.6 My problem is when

[sqlalchemy] Re: relations with additional criteria

2009-10-08 Thread Michael Bayer
Martijn Faassen wrote: What it does is filter on a workflow status. I.e. I want a number of relations, one of which shows all related objects, the other one restricts by some status of the target. This way I can navigate an object graph and only see, say, published items, or items that can

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Michael Bayer
Tefnet Developers wrote: Dnia 2009-10-08, czw o godzinie 09:59 -0400, Michael Bayer pisze: Is this a SQLAlchemy bug or my mistake? Backrefs deal with the two-way relation between A-B, but the event does not propagate in most cases to C or beyond, i.e. A-B-C where B is attached to A would

[sqlalchemy] Re: Execution of stored procedure on SQL Server 2008

2009-10-08 Thread Michael Bayer
Nicol van der Merwe wrote: My problem is when I am trying to execute a stored procedure and use the commit and rollback features of sqlAlchemy. the issue is the usage of db.bind.execute(statement). This system uses SQLA's autocommit behavior which is not detecting the textual statements

[sqlalchemy] Re: Update primary key with inheritance

2009-10-08 Thread Michael Bayer
Marble wrote: Can someone help me to get this right? this is ticket 1362 and is a TODO:http://www.sqlalchemy.org/trac/ticket/1362. My fault, I should have checked the tickets before posting. For now you need to issue update() statements for the tables manually,then reload your objects.

[sqlalchemy] Re: Execution of stored procedure on SQL Server 2008

2009-10-08 Thread Nicol van der Merwe
On Thu, Oct 8, 2009 at 5:20 PM, Michael Bayer mike...@zzzcomputing.comwrote: Nicol van der Merwe wrote: My problem is when I am trying to execute a stored procedure and use the commit and rollback features of sqlAlchemy. the issue is the usage of db.bind.execute(statement). This system

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-08 Thread volx
All has been working fine in 0.6, Mike. Thanks. Out of curiosity how do you unit test against Oracle. Do you use some kind of mock object? On Oct 4, 10:01 am, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 3, 2009, at 5:18 PM, volx wrote: Hi Mike: Thank you for that. I will try

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-08 Thread Michael Bayer
volx wrote: All has been working fine in 0.6, Mike. Thanks. Out of curiosity how do you unit test against Oracle. Do you use some kind of mock object? the test suite has --db and --dburi options that allow any URI to be used for tests. i.e. nosetests --dburi

[sqlalchemy] Re: relations with additional criteria

2009-10-08 Thread Martijn Faassen
Hey, Michael Bayer wrote: [snip] well that is the part of the use case I don't understand. Why the automagic aspect of it ? and if there are dozens of target tables that have similar attributes, why not reduce the workload in a more boring way, like one that just adds the attributes after

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Michael Bayer
Christoph Zwerschke wrote: @Mike: The test code says in a comment flushing at this point means its anyone's guess. Can you elaborate what is meant by this comment? I had the idea that since a1 appears to be in the collections of both u1 and u2, it would be arbitrary where a1 ended up after

[sqlalchemy] Re: Synchronization problem at backref of a one-to-many relation to the same class.

2009-10-08 Thread Michael Bayer
On Oct 8, 2009, at 4:02 PM, Christoph Zwerschke wrote: So this behavior is in fact intended by SQLAlchemy. As Mike explained, this is because propagating events further than the 2 objects directly involved would become too complex, possibly leading to recursion and performance issues. the