[sqlalchemy] Questions about sessions connections

2010-12-21 Thread Franck Vonbau
Dear all, I'm starting a web project based on Python, and I've decided to rely on web.py and SQLAlchemy. My DB is for the moment a SQLite database, and I'm trying to figure out how the framework deals with sessions / transactions. Your help would be greatly appreciated ! Here's how I

Re: [sqlalchemy] Re: Sqlsoup: slow commit on update

2010-12-21 Thread Diego Woitasen
If I set expire_on_commit=False only the modified object will be written? I don't know if there is a better way to do this (short version): mail_items = mboxgroup_db.mail_item.filter(msg_filter).all()--- this returns 636000 objects for mail_item in mail_items: do_something(mail_item)

[sqlalchemy] something wrong with relationship caching at _trunk_

2010-12-21 Thread sector119
Hello! I have a problem with my relationship caching with 0.7b1 (current trunk) When I perform query on `User` model with `username` param, than access some lazy and cached separaterly from main query relationship - `groups`. After that I exec the same query on `User` model with another

[sqlalchemy] Excluding tables

2010-12-21 Thread tim
Hi, I have some meta-data columns in my schema. How can I make sure they are not part of the SELECT, INSERT and UPDATE statements SQLAlchemy is doing in the background? I tried: Column('lastUpdate', DateTime, DefaultClause('CURRENT_TIMESTAMP'), nullable=False), # for Nebula's Syncer along

Re: [sqlalchemy] Re: Sqlsoup: slow commit on update

2010-12-21 Thread Michael Bayer
On Dec 21, 2010, at 6:59 AM, Diego Woitasen wrote: If I set expire_on_commit=False only the modified object will be written? I don't know if there is a better way to do this (short version): mail_items = mboxgroup_db.mail_item.filter(msg_filter).all()--- this returns 636000

Re: [sqlalchemy] something wrong with relationship caching at _trunk_

2010-12-21 Thread Michael Bayer
I couldn't begin to know what the issue is with code fragments like this. Though your print_groups() function here is wrong: def print_groups(user): for g in u.groups: print g.name On Dec 21, 2010, at 9:15 AM, sector119 wrote: Hello! I have a problem with my relationship

Re: [sqlalchemy] Running an ORM query during Session after_attach event

2010-12-21 Thread Torsten Landschoff
On Mon, 2010-12-20 at 10:16 -0500, Michael Bayer wrote: On Dec 20, 2010, at 3:42 AM, Torsten Landschoff wrote: INSERT INTO group_items (group_id, item_id, item_order) VALUES (?, ?, ?) (None, None, None) Both the group and the item where created correctly so I ended up with a database

[sqlalchemy] Re: something wrong with relationship caching at _trunk_

2010-12-21 Thread sector119
Yep, it's should be: def print_groups(u) Michael, do you need complete (with data) working (or working wrong:) sample? That code is working... But with existing data... On 21 Грд, 16:39, Michael Bayer mike...@zzzcomputing.com wrote: I couldn't begin to know what the issue is with code

Re: [sqlalchemy] Re: something wrong with relationship caching at _trunk_

2010-12-21 Thread Michael Bayer
if you could narrow it down, that would be the helpful thing here. just two model classes, three rows of test data, two queries, one file, plain memory caching like the examples/ version. On Dec 21, 2010, at 9:49 AM, sector119 wrote: Yep, it's should be: def print_groups(u) Michael, do

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Michael Bayer
On Dec 21, 2010, at 8:36 AM, tim wrote: Hi, I have some meta-data columns in my schema. How can I make sure they are not part of the SELECT, INSERT and UPDATE statements SQLAlchemy is doing in the background? I tried: Column('lastUpdate', DateTime,

Re: [sqlalchemy] Re: something wrong with relationship caching at _trunk_

2010-12-21 Thread Michael Bayer
oh and the other thing if that's too much, step through SQLAlchemy versions and figure out the changeset that breaks your app. When I do that task, I do it as a binary search, i.e. first try a version in the middle between the good and the bad, then cut each time till you get to the

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Tim Aerts
Yes, I do want to exclude it all together. But we are creating the database from a createall() call. So if leave it out of the SA schema definition, it will also disappear in the CREATE TABLE statements. Is there any way, whatsoever, to included them in the SA-generated CREATE TABLE DDL

Re: [sqlalchemy] Get properties of a class mapped with SqlAlchemy (and its sqlalchemy.orm.synonym)

2010-12-21 Thread Hector Blanco
First of all, thank you for replying. I don't really know if I understood your idea. I dug a bit more in the User class (not the instance, but what it would be self.__class__) and the problem is that both password and _password have a __get__: I changed the getProperties method a bit, to

Re: [sqlalchemy] Get properties of a class mapped with SqlAlchemy (and its sqlalchemy.orm.synonym)

2010-12-21 Thread Hector Blanco
I found a maybe way... but I don't know if it's good idea... the propertyProxy instances have a field called descriptor which the InstrumentedAttribute don't have... so I can always do this: -- def getProperties4(cls): properties = list()

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Michael Bayer
On Dec 21, 2010, at 10:09 AM, Tim Aerts wrote: Yes, I do want to exclude it all together. But we are creating the database from a createall() call. So if leave it out of the SA schema definition, it will also disappear in the CREATE TABLE statements. Is there any way, whatsoever, to

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Tim Aerts
I have found something that works. I'll share it here for future reference. 1. To the MetaData I have added all the columns, etc that I needed to have in my actual DB (but not in my SA-mapping). 2. I used that MetaData structure for the create_all() call. This takes care of the

[sqlalchemy] Getting a list of parameters from a select object Options (cont'd)

2010-12-21 Thread Will
In continuation of the following post http://groups.google.com/group/sqlalchemy/browse_thread/thread/160870682c011611/8229a3eb9c10f870?lnk=gstq=parameters+select#8229a3eb9c10f870 Is there a way to get the columns that the bind parameters correspond to? I was able to get the param values but

Re: [sqlalchemy] Get properties of a class mapped with SqlAlchemy (and its sqlalchemy.orm.synonym)

2010-12-21 Thread Hector Blanco
Ah... much better :) def getProperties2(instance): properties = list() mapper = sqlalchemy.orm.object_mapper(instance) for prop in mapper.iterate_properties: if isinstance(prop, sqlalchemy.orm.properties.SynonymProperty):

Re: [sqlalchemy] Excluding tables

2010-12-21 Thread Michael Bayer
Not sure why the documented approaches to server-side defaults aren't working for you - I continue to recommend their use, or if there is some malfunction I'd like to know of that as well so that it may be fixed. I use server-side defaults on columns that are otherwise never touched by SQLA

Re: [sqlalchemy] SQLAlchemy-Future

2010-12-21 Thread Hong Minhee
Thanks for your fine answer. Is there any plan of defining sqlalchemy.contrib namespace package into current 0.7 branch or 0.6.x release? I hope for it to be clear. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email