[sqlalchemy] pool timeout issue in 0.3.9

2007-07-20 Thread Michael Bayer
hey list - we've identified an issue with the connection pool released in 0.3.9 whereby threads can immediately throw a TimeoutError without waiting for the pool_timeout number of seconds to have elapsed. This can occur if many threads, greater than the number of total connections allowed,

[sqlalchemy] doing a one() on a unique key

2007-07-20 Thread Marco De Felice
Hi all for my first post I'm using the new one() method like this: query(Table).filter_by(and_(Table.c.field1 == val1, Table.c.field2 == val2)).one() filed1 + field2 has a unique constraint in Table, so there won't never be more than one row returned, but there may be none. When there's none I

[sqlalchemy] Re: doing a one() on a unique key

2007-07-20 Thread svilen
i think there was .one() to return one and only one and die otherwise i.e. match {1}, and first() or similar that allows match {0,1}. On Friday 20 July 2007 18:42:56 Marco De Felice wrote: Hi all for my first post I'm using the new one() method like this:

[sqlalchemy] Issue when loading module in scheduler utility

2007-07-20 Thread Jesse James
I am creating a persistent job scheduler utility in my TG application and have run into a minor issue regarding SqlAlchemy. When a scheduled job is run, its specified module is loaded using __import__ . This works fine unless the loaded module has an 'import model' in it. If so, I get this:

[sqlalchemy] Re: looking to make

2007-07-20 Thread jason kirtland
Mike wrote: sounds good. Looking forward to see it in 3.10dev The case-check cache in the trunk and will be in the forthcoming 0.3.10. Since it's a connection-scoped cache, you'll want to re-use the same connection for all of the table autoloads you're doing. If you're autoloading at the

[sqlalchemy] Many to many to same table

2007-07-20 Thread Koen Bok
Hello, I am trying to do something odd, but I was wondering if this could be done with SQLAlchemy. See the script for details: from sqlalchemy import * metadata = BoundMetaData('sqlite://') class Item(object): def __init__(self, name): self.name = name def

[sqlalchemy] Re: Many to many to same table

2007-07-20 Thread Michael Bayer
yup, just spell it out item_mapper = mapper(Item, item_table, properties=dict( collections=relation(Item, secondary=collection_table ,lazy=True, primaryjoin=item_table.c.id==collection_table.c.id_coll, secondaryjoin=item_table.c.id==collection_table.c.id_item,

[sqlalchemy] sqlalchemy 0.3.10 released

2007-07-20 Thread Michael Bayer
this is a minor release that is primarily to fix a connection pool issue revealed earlier today. The pool issue was introduced in 0.3.9 and did not exist in prior versions, and only affects the behavior of timeout, nothing to do with the state integrity of the pool or its connections. The

[sqlalchemy] Re: Many to many to same table

2007-07-20 Thread Koen Bok
Thanks Michael, thats just too cool! On Jul 20, 10:35 pm, Michael Bayer [EMAIL PROTECTED] wrote: yup, just spell it out item_mapper = mapper(Item, item_table, properties=dict( collections=relation(Item, secondary=collection_table ,lazy=True,

[sqlalchemy] Re: Issue when loading module in scheduler utility

2007-07-20 Thread sdobrev
this ain't SA issue, but if u want a solution, u have to provide more data, and do some prints here-there. When a scheduled job is run, its specified module is loaded using __import__ . This works fine unless the loaded module has an 'import model' in it. If so, I get this: Traceback (most

[sqlalchemy] Multiple foreign keys to the same table from another table

2007-07-20 Thread Sean Davis
I have a table that has two columns that reference the same table in a foreign-key relationship. What do I need to specify and where to avoid the error below? class 'sqlalchemy.exceptions.ArgumentError': Error determining primary and/or secondary join for relationship 'FeatureLoc.feature

[sqlalchemy] Re: Multiple foreign keys to the same table from another table

2007-07-20 Thread Sean Davis
On Jul 20, 11:57 pm, Sean Davis [EMAIL PROTECTED] wrote: I have a table that has two columns that reference the same table in a foreign-key relationship. What do I need to specify and where to avoid the error below? class 'sqlalchemy.exceptions.ArgumentError': Error determining primary