RE: [sqlalchemy] In case of joinedload_all how do I order by on a columns of those relations

2011-06-29 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Marc Van Olmen Sent: 29 June 2011 04:19 To: sqlalchemy Subject: [sqlalchemy] In case of joinedload_all how do I order by on a columns of those relations Hi I'm trying to

[sqlalchemy] SA and IBM DB2

2011-06-29 Thread Luca Lesinigo
Hello there. I'd like to use SQLalchemy with an existing db2 database (I can already access it with plain SQL using pyODBC from a python-2.6/ win32 system). Googling around, I found http://code.google.com/p/ibm-db and it seems to have an updated DB-API driver for python-2.6/win32, but the latest

Re: [sqlalchemy] SA and IBM DB2

2011-06-29 Thread Michael Bayer
On Jun 29, 2011, at 6:43 AM, Luca Lesinigo wrote: Hello there. I'd like to use SQLalchemy with an existing db2 database (I can already access it with plain SQL using pyODBC from a python-2.6/ win32 system). Googling around, I found http://code.google.com/p/ibm-db and it seems to have an

Re: [sqlalchemy] Problem with DeclarativeMeta

2011-06-29 Thread Michael Bayer
On Jun 28, 2011, at 11:24 PM, Mike Conley wrote: We have a database of about 100 tables with timestamp audit columns on most, but not all tables, and use declarative to describe the database. I am attempting to use a metaclass to create a base class that defines the audit columns so we

[sqlalchemy] Re: Slightly confusing error when session set up incorrectly

2011-06-29 Thread Ben Sizer
On Jun 29, 6:46 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 28, 2011, at 9:34 PM, Ben Sizer wrote: What does the None None signify? Would it be possible to change this exception to be a bit more descriptive and a little less cryptic? eg. Include the URI that failed? That

Re: [sqlalchemy] Re: Slightly confusing error when session set up incorrectly

2011-06-29 Thread Michael Bayer
On Jun 29, 2011, at 12:24 PM, Ben Sizer wrote: the lazy initializing behavior of the Session is documented: http://www.sqlalchemy.org/docs/orm/session.html#unitofwork-transaction Not exactly. It says it maintains a connection for each SQL statement, OK, this happens a lot with me, if

Re: [sqlalchemy] SQLAlchemy mapped classes and __new__ (ClassManager.new_instance undocumented)

2011-06-29 Thread Torsten Landschoff
Hi Michael, On Tue, 2011-06-28 at 10:28 -0400, Michael Bayer wrote: ClassManager class is not documented. What should I be using instead? Instrumentation has to establish state on a new object independent of __new__() - during pickling, the state is restored naturally as __dict__ is

[sqlalchemy] UniqueConstraint breaks combination of ordering_list and association_proxy

2011-06-29 Thread Torsten Landschoff
Hi Michael, hi *, here is another issue I ran into with SQLAlchemy. Basically, I am trying to map a filesystem like structure to SQL. Unfortunately, there is a difference in that the users can reorder the tree. I reduced my code to the attached example. Mapping the structure worked quite good so

Re: [sqlalchemy] SQLAlchemy mapped classes and __new__ (ClassManager.new_instance undocumented)

2011-06-29 Thread Michael Bayer
On Jun 29, 2011, at 2:46 PM, Torsten Landschoff wrote: Hi Michael, On Tue, 2011-06-28 at 10:28 -0400, Michael Bayer wrote: ClassManager class is not documented. What should I be using instead? Instrumentation has to establish state on a new object independent of __new__() - during

Re: [sqlalchemy] UniqueConstraint breaks combination of ordering_list and association_proxy

2011-06-29 Thread Michael Bayer
On Jun 29, 2011, at 3:22 PM, Torsten Landschoff wrote: Hi Michael, hi *, here is another issue I ran into with SQLAlchemy. Basically, I am trying to map a filesystem like structure to SQL. Unfortunately, there is a difference in that the users can reorder the tree. I reduced my code to

Re: [sqlalchemy] SQLAlchemy mapped classes and __new__ (ClassManager.new_instance undocumented)

2011-06-29 Thread Torsten Landschoff
On Wed, 2011-06-29 at 15:31 -0400, Michael Bayer wrote: I'm not sure offhand if __new__() can be wrapped in a monkeypatch the way we do for __init__(), or if so what are the side effects of that, and it also would mean there's no way to create a new instance without ._sa_instance_state being

[sqlalchemy] Full-fledged objects as mapped attributes?

2011-06-29 Thread Jason Denning
Hi All, I am building a Pyramid app using SQLAlchemy for the model, and I would like to be able to use the attributes as full-fledged objects (i.e., I would like to be able to define methods attached to the attributes), ideal example usage (although this is a somewhat contrived example): class

[sqlalchemy] How to get setter-like behaviour universally across a custom type? (with UTC DateTime examples)

2011-06-29 Thread Russ
I have a typical case where I want to ensure that datetime values sent to the database are UTC, and values read from the database come back as offset-aware UTC times. I see several threads on the issue (eg: http://goo.gl/FmdIJ is most relevant), but none address my question that I can see. UTC

[sqlalchemy] Re: How to get setter-like behaviour universally across a custom type? (with UTC DateTime examples)

2011-06-29 Thread Russ
When I realized that process_bind_param only happens on commit, I decided to switch my strategy to simply confirming that all incoming outgoing datetime values are offset-aware UTC using this simpler code: http://pastebin.com/gLfCUkX3 Sorry - I messed up that code segment on edit for