[sqlalchemy] Re: Exception during cleanup leaking DB connections?

2010-06-28 Thread jgarbers
On Jun 25, 9:53 am, Michael Bayer wrote: > Beyond that, assuming you're using the ORM, and are ensuring that you fully > exhaust any row-based result sets that you get from Session.execute(), all > connections are returned to the pool explicitly without reliance on GC. Michael, thanks very much

[sqlalchemy] Exception during cleanup leaking DB connections?

2010-06-25 Thread jgarbers
I'm using SQLA in a CherryPy / WSGI--based application running behind Apache2. The database is hosted on Amazon RDS (MySQL). Recently I've noticed several errors like this in my logs: [error] Exception AttributeError: AttributeError("'NoneType' object has no attribute 'pop'",) in > ignored I'm us

[sqlalchemy] Re: Rolling back an ALTER TABLE in sqlite3?

2010-05-29 Thread jgarbers
On May 29, 2:42 pm, Michael Bayer wrote: > to my knowledge sqlite does not support transactional DDL (seems to have some > support, but its not fully operational) Hi, Michael -- and thanks for your quick help. I found a thread that does seem to indicate that ALTER TABLE should roll back: http:

[sqlalchemy] Rolling back an ALTER TABLE in sqlite3?

2010-05-29 Thread jgarbers
I'm trying to do an in-place database "upgrade" -- if I detect that a column is missing, I use ALTER TABLE to add the column and then compute values for the new column for each row. I'd like this to all happen within a transaction, so the column doesn't get added unless the new values are successf

[sqlalchemy] Finding elements in a relation-defined list

2010-01-23 Thread jgarbers
Another rookie question, and sorry if I've titled it awkwardly. My User object has a one-to-many relation to an Account object. The relation is defined with 'accounts = relation("Account")' . As I understand it, given an instance of User, this lets me easily get to his accounts with user.accounts;

[sqlalchemy] Consolidating queries for account lookup

2010-01-23 Thread jgarbers
I have three tables managed by SQLA: 'user' (with a 'username' column), 'server' (with 'servername' column), and 'account' (with 'password' column and foreign keys referring to 'user' and 'server'). The account table basically says "user X has an account on server Y with password Z". All are define

[sqlalchemy] Re: Creating a polymorphic object?

2009-12-07 Thread jgarbers
On Dec 7, 11:18 am, "Michael Bayer" wrote: > it seems like you basically want access to the dictionary of type->class. >  You can get this off the base mapper (i.e. class_mapper(BaseClass) ) in a > dictionary called "polymorphic_map". Ah, thank you - exactly what I needed. It took me a moment to

[sqlalchemy] Creating a polymorphic object?

2009-12-07 Thread jgarbers
I'm using SQLAlchemy's declarative mode with polymorphic relationships, so I have a base Node class along with several child classes (ListNode, FileNode, etc.) A polymorphic_identity in the Node table determines the class of object being loaded (node_type = 'list', 'file', etc.). Each child class

[sqlalchemy] Re: Creating container relationship in declarative SQLAlchemy

2009-11-24 Thread jgarbers
On Nov 24, 3:11 pm, Conor wrote: > Here is one way you can define your secondary table and ListNode: > > class ListNode(Node): >     __mapper_args__ = {'polymorphic_identity': 'list'} >     __tablename__ = 'nodes_list' > >     id = Column(Integer, ForeignKey('nodes.id'), primary_key=True) >     c

[sqlalchemy] Creating container relationship in declarative SQLAlchemy

2009-11-24 Thread jgarbers
Hi! I've posted this question over on Stack Overflow -- thought perhaps the mailing list might be a better resource for help. (If you're a Stack Overflow user and want the points, here's the link: http://stackoverflow.com/questions/1791713/creating-container-relationship-in-declarative-sqlalchemy