[sqlalchemy] Re: Persistence of Python Objects with respect to the Session

2009-10-14 Thread mviamari
). Thanks, Mike On Oct 14, 7:00 am, Michael Bayer mike...@zzzcomputing.com wrote: mviamari wrote: Hello, I'm writing tests for my database, and I've run into a little bit of confusion. Say I have a class (we'll call it person) with two declared attributes that correspond to db columns

[sqlalchemy] Re: Persistence of Python Objects with respect to the Session

2009-10-14 Thread mviamari
attributes, deleted attributes, or data transformations when committed to the database (i.e. 10/11/2009 becomes datatime(2009, 10, 11)). Thanks Mike On Oct 14, 6:44 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 14, 2009, at 9:15 PM, mviamari wrote: So if I read the documentation right

[sqlalchemy] Re: Persistence of Python Objects with respect to the Session

2009-10-14 Thread mviamari
UPDATE: If I inject a session.expunge_all() before I query the DB for the objects again, the undeclared attribute is no longer present (i.e. I get the AttributeError I expect). On Oct 14, 7:08 pm, mviamari mviam...@gmail.com wrote: Michael, First, Thanks for your help. Second, something

[sqlalchemy] Persistence of Python Objects with respect to the Session

2009-10-13 Thread mviamari
Hello, I'm writing tests for my database, and I've run into a little bit of confusion. Say I have a class (we'll call it person) with two declared attributes that correspond to db columns: person.id person.name If I randomly assign a person object another attribute dynamically:

[sqlalchemy] Autoincrement Primary Keys vs. Added with an explicit Key

2009-07-18 Thread mviamari
Hello, I have a table with a simple PK ('id') that is setup to autoincrement whenever a record is added to the table. This PK is also a FK in another table. Generally this works perfectly well. The problem occurs when I add a record using an explicit value for 'id' (reading from a backup data

[sqlalchemy] sqlalchemy.extract with dates

2009-07-17 Thread mviamari
I upgrade to 0.5.5 from 0.5.2 the other day and it broke a working query. I was simply querying the maximum year in my table, by extracting from the date column: query = session.query(extract('year', Order.date).label ('year')).distinct().subquery() -- Exception raised here min =