[sqlalchemy] Re: Operational Error raised by except_

2011-01-13 Thread neurino
Thanks Michael, just for following readers I precise the ORDER BY clause causing the OperationalError is the one coming *before* the EXCEPT so I had to add .order_by(None) to the first query, now it looks like: Session.query(model.Sensor) \ .order_by(None) \ .except_(

Re: [sqlalchemy] SQLAlchemy 0.6.6 Released

2011-01-13 Thread Piotr Ozarowski
[Michael Bayer, 2011-01-09] The 0.6 series is not surprisingly our most successful series ever, with SQLA 0.6.5 racking up 36,000 downloads from Pypi in a period of 76 days, approximately 15K per month, plus about 2K a month from Sourceforge. + at least 4241 installations via .deb files (note

[sqlalchemy] Implementing a specific commit/refresh strategy for one table only

2011-01-13 Thread Franck
Dear all, I've decided to plug SQLAlchemy to my web framework in order to let SQLAlchemy handle the framework's user sessions. Theses sessions require a lot of SELECT and UPDATE all the time. Therefore, I'd like to toggle expire_on_commit and (possibly) autocommit *for the SESSIONS table only.*

[sqlalchemy] Several many to many table joins with sqlalchemy

2011-01-13 Thread pr64
Hi, New with SQLalchemy, here is my problem: My model is: user_group_association_table = Table('user_group_association', Base.metadata, Column('user_id', Integer, ForeignKey('user.id')), Column('group_id', Integer, ForeignKey('group.id')) ) department_group_association_table =

Re: [sqlalchemy] can't build c extensions for 0.6.6 on CentOS 5.5

2011-01-13 Thread Michael Bayer
assuming this is also your ticket #2023 ? http://www.sqlalchemy.org/trac/ticket/2023 On Jan 12, 2011, at 11:40 AM, Jon Nelson wrote: I'm unable to build the C extensions for SQLAlchemy 0.6.6 on CentOS 5.5: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall

Re: [sqlalchemy] can't build c extensions for 0.6.6 on CentOS 5.5

2011-01-13 Thread Jon Nelson
On Thu, Jan 13, 2011 at 9:12 AM, Michael Bayer mike...@zzzcomputing.com wrote: assuming this is also your ticket #2023 ? http://www.sqlalchemy.org/trac/ticket/2023 That is not my ticket, but surely appears to be related! -- Jon -- You received this message because you are subscribed to

Re: [sqlalchemy] guard all session.query with try except?

2011-01-13 Thread Michael Bayer
I'd certainly never do that - no matter what type of application is running, its always best to use transaction-per-logical operation, which means usually, transactions are short. If the transactions are necessarily long, a database failure in the middle means the operation just fails, but

Re: [sqlalchemy] Implementing a specific commit/refresh strategy for one table only

2011-01-13 Thread Michael Bayer
You'd implement the expire yourself using SessionExtension.after_commit(). On Jan 13, 2011, at 9:18 AM, Franck wrote: Dear all, I've decided to plug SQLAlchemy to my web framework in order to let SQLAlchemy handle the framework's user sessions. Theses sessions require a lot of SELECT

[sqlalchemy] Re: Mapper.get_property question

2011-01-13 Thread Eric Lemoine
On Wednesday, January 12, 2011, Michael Bayer mike...@zzzcomputing.com wrote: The name of the property from the mapper perspective is name.  That's the contract of declarative: class MyClass(some_declarative_base):     __tablename__ = 'j'     x = Column(Integer, key='z')     y =

[sqlalchemy] Best way to reduce boilerplate?

2011-01-13 Thread Randall Nortman
I am finding myself doing a fair amount of copy-and-paste in the data model I'm currently working on, and I'd like to reduce that if possible. For example, I have several different types of objects that have names belonging to namespaces. So every such table gets boilerplate looking like this

Re: [sqlalchemy] Best way to reduce boilerplate?

2011-01-13 Thread Michael Bayer
On Jan 13, 2011, at 12:11 PM, Randall Nortman wrote: I am finding myself doing a fair amount of copy-and-paste in the data model I'm currently working on, and I'd like to reduce that if possible. For example, I have several different types of objects that have names belonging to namespaces.

[sqlalchemy] dirtying attributes of a user-defined type

2011-01-13 Thread A.M.
Hello, I have created an SQLAlchemy type which represents a postgresql aclitem (which represents postgresql access control lists). I am able to load and save newly-created ACLItems from the database, however, modifying the values of an instance of the type does not dirty it for flushing. Is

[sqlalchemy] Insert record error

2011-01-13 Thread wilbur
Hi, I am getting an error trying to insert records into a PostgreSQL database with SQLAlchemy. My table definition: class dream4_eta_15km_pm10(Base): __tablename__='pm10_dream_rasters' gid=Column(Integer,Sequence('pm10_dream_rasters_gid_seq'),primary_key=True)

Re: [sqlalchemy] dirtying attributes of a user-defined type

2011-01-13 Thread Michael Bayer
There's mistakes in how this is structured. UserDefinedType represents a type object applied to a Column. The actual data handled by such a type is not meant to be an instance of the type itself. ACLItem() here would be its own class, and UserDefinedType would be the superclass of a class

[sqlalchemy] Re: Best way to reduce boilerplate?

2011-01-13 Thread Randall Nortman
On Jan 13, 1:00 pm, Michael Bayer mike...@zzzcomputing.com wrote: [...] Mixins are extensively documented at http://www.sqlalchemy.org/docs/orm/extensions/declarative.html#mixin-classes So they are! I really should read the What's New in 0.x document before switching to 0.x. What a nice

Re: [sqlalchemy] Insert record error

2011-01-13 Thread Michael Bayer
The gid is fine here, its the presence of GeoAlchemy objects sent as bind parameters where they're not able to be rendered as function calls inline with the SQL. You should check with the GeoAlchemy list (http://groups.google.com/group/geoalchemy) with a full example of your insert statement,

Re: [sqlalchemy] Insert record error

2011-01-13 Thread Eric Lemoine
On Thursday, January 13, 2011, wilbur bhudsp...@edac.unm.edu wrote: Hi, I am getting an error trying to insert records into a PostgreSQL database with SQLAlchemy. My table definition: class dream4_eta_15km_pm10(Base):    __tablename__='pm10_dream_rasters'

[sqlalchemy] Re: Insert record error

2011-01-13 Thread wilbur
Thanks! On Jan 13, 1:32 pm, Michael Bayer mike...@zzzcomputing.com wrote: The gid is fine here, its the presence of GeoAlchemy objects sent as bind parameters where they're not able to be rendered as function calls inline with the SQL.  You should check with the GeoAlchemy list

Re: [sqlalchemy] Insert record error

2011-01-13 Thread William Hudspeth
Thanks for responding, I tried changing the geometry object definition, as well as the model definition and I get the same result... dream_geom=MULTIPOLYGON((-120.000 43.833,-96.833 43.833,-96.833 26.000,-120.000 26.000,-120.000 43.833)) class dream4_eta_15km_pm10(Base):

[sqlalchemy] sqlalchemy rocks my socks off!

2011-01-13 Thread rdlowrey
To Michael Bayer: sqlalchemy simplifies my life every day and makes me vastly more productive! Many thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this

Re: [sqlalchemy] Unnecessary SQL emitted after a commit to get a PK?

2011-01-13 Thread Russ
On Wednesday, January 12, 2011 2:16:00 PM UTC-5, Michael Bayer wrote: Suppose a concurrent thread or process deleted your row in a new transaction and committed it, or didn't even commit yet hence locked the row, in between the time you said commit() and later attempted to access the

[sqlalchemy] Can expire_on_commit be made to apply at an object level (instead of everything in the session)?

2011-01-13 Thread Russ
On Wednesday, January 12, 2011 2:16:00 PM UTC-5, Michael Bayer wrote: see expire_on_commit=False as well as Session.commit() for further detail: http://www.sqlalchemy.org/docs/orm/session.html#committing http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.Session.commit To

Re: [sqlalchemy] Can expire_on_commit be made to apply at an object level (instead of everything in the session)?

2011-01-13 Thread Michael Bayer
On Jan 13, 2011, at 10:18 PM, Russ wrote: On Wednesday, January 12, 2011 2:16:00 PM UTC-5, Michael Bayer wrote: see expire_on_commit=False as well as Session.commit() for further detail: http://www.sqlalchemy.org/docs/orm/session.html#committing

Re: [sqlalchemy] Can expire_on_commit be made to apply at an object level (instead of everything in the session)?

2011-01-13 Thread Russ
On Thursday, January 13, 2011 10:29:10 PM UTC-5, Michael Bayer wrote: So you're looking to do a write-through cache here, i.e. write the DB, then write the value straight to the cache. I think if you were to say session.flush(), which emits the SQL, then detach all the objects using

[sqlalchemy] Re: guard all session.query with try except?

2011-01-13 Thread can xiang
Thanks for your advise. My application is a tornadoweb app. So I'm going to create Session() for each request. On Jan 13, 11:23 pm, Michael Bayer mike...@zzzcomputing.com wrote: I'd certainly never do that - no matter what type of application is running, its always best to use