[sqlalchemy] Re: concurrent versions of SA

2009-09-22 Thread werner
Peter, PD wrote: Hi, please can someone help me with this (maybe simple solution): Is it possible to install two (or more) versions of SA in one Python environment and import specific version? E.g. when migrating from old version. If you installed using easy_setup then you can do:

[sqlalchemy] Re: concurrent versions of SA

2009-09-22 Thread werner
werner wrote: Peter, PD wrote: Hi, please can someone help me with this (maybe simple solution): Is it possible to install two (or more) versions of SA in one Python environment and import specific version? E.g. when migrating from old version. If you installed using

[sqlalchemy] Beginner inheritance question

2009-09-22 Thread Iwan
Hi there, this is perhaps a stupid question, but we can't get it figured out from the docs on inheritance... Is it possible in sqlalchemy to have a hierarchy of classes of which only the root class in the hierarchy is mapped to the database at all. (So the subclasses do not have any persisted

[sqlalchemy] Re: concurrent versions of SA

2009-09-22 Thread werner
PD wrote: Hi, please can someone help me with this (maybe simple solution): Is it possible to install two (or more) versions of SA in one Python environment and import specific version? E.g. when migrating from old version. You might also want to look into:

[sqlalchemy] How to replace a property in a declarative way

2009-09-22 Thread Kees van den Broek
Hi, I simplified my problem to a small example (see model below). A Product has several Tags attached. A beachball is green, blue, round and big: p=Product() p.name = Beachball p.tags = [greenTag, blueTag, roundTag, bigTag] DBSession.save(p) Often I just want to see the color-related tags, not

[sqlalchemy] object serializer

2009-09-22 Thread Julien Cigar
Hello, I'm busy to make a kind of mapper exporter/serializer. My goal is to be able to serialize (in JSON, XML, ...) any Mapper object (including relations, etc) At the moment I've the following code (not finished at all) : http://www.pastie.org/625787 As you can see I'm iterating over

[sqlalchemy] Re: How to replace a property in a declarative way

2009-09-22 Thread Conor
On Sep 22, 5:57 am, Kees van den Broek kees...@gmail.com wrote: Hi, I simplified my problem to a small example (see model below). A Product has several Tags attached. A beachball is green, blue, round and big: p=Product() p.name = Beachball p.tags = [greenTag, blueTag, roundTag, bigTag]

[sqlalchemy] Re: How to replace a property in a declarative way

2009-09-22 Thread Conor
On Sep 22, 9:39 am, Conor conor.edward.da...@gmail.com wrote: On Sep 22, 5:57 am, Kees van den Broek kees...@gmail.com wrote: Hi, I simplified my problem to a small example (see model below). A Product has several Tags attached. A beachball is green, blue, round and big: p=Product()

[sqlalchemy] SqlAlchemy results differ from its generated SQL

2009-09-22 Thread Mike Driscoll
Hi, When I run a simple query like this: qry = session.query(CheckHistory) qry = qry.filter(and_(CheckHistory.CHECK_DATE = '1/1/2007', CheckHistory.CHECK_DATE = '1/1/2008')) res = qry.all() I get one CheckHistory row and a None. If I run the echoed SQL code in

[sqlalchemy] Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread Randall Nortman
In my application, I have a set of tables that model parts of what are conceptually composite objects, and I need to validate that the state of the objects is coherent before committing them to the database. In the course of building up the network of objects, the state may be temporarily

[sqlalchemy] Adjacency tree linked list

2009-09-22 Thread Shuaib Osman
Hi guys, I’m to build an adjacency list in SA and have looked at the basic_tree.py example provided, however, I need to order the children. Now I don’t really want to use nested sets and I know linked lists can be implemented in SA quite easily. So naturally I tried something like trees =

[sqlalchemy] Inheritance + Pseudo-adjacency-list?

2009-09-22 Thread Kevin H
I'm having some trouble developing my model, and was hoping someone on this list could help... Here's what I want: A BizEntity object A Person and Company object (both descended from BizEntity, using joined table inheritance) A Company.employees attribute, which points to a list of Persons who

[sqlalchemy] Re: Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Randall Nortman Sent: 22 September 2009 16:31 To: sqlalchemy Subject: [sqlalchemy] Pre-commit validation spanning multiple tables/ORM classes [SNIP] So if I do this with

[sqlalchemy] Re: checking a relationship exists

2009-09-22 Thread joeformd
thanks - but how does that query specify a town? It seems like that would just return true if the current user had any town relationships? Or am I reading it wrong? On Sep 19, 5:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 19, 2009, at 11:41 AM, joeformd wrote: When we

[sqlalchemy] Re: Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread bojanb
My issue with SQLA validators is that they don't allow inconsistent state even on fields of a single object, which makes multi-field validation impossible. Eg. imagine you have fields tax_id and country_code on a customer object. For country code 'us', tax_id should be 9 digits long; for country

[sqlalchemy] Re: Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread Michael Bayer
bojanb wrote: My issue with SQLA validators is that they don't allow inconsistent state even on fields of a single object, which makes multi-field validation impossible. meaning, you set A.a and you can't depend on A.b being correct yet ? Well sure. How would you have it done ? Something

[sqlalchemy] Re: Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread bojanb
meaning, you set A.a and you can't depend on A.b being correct yet ?   Well sure.  How would you have it done ?  Something has to trigger the validate event at some point.     So if you need to wait for all of A.a, A.b, A.c, etc. to be setup first, then sure you'd throw your validation into

[sqlalchemy] Re: SqlAlchemy results differ from its generated SQL

2009-09-22 Thread Michael Bayer
On Sep 22, 2009, at 11:09 AM, Mike Driscoll wrote: Hi, When I run a simple query like this: qry = session.query(CheckHistory) qry = qry.filter(and_(CheckHistory.CHECK_DATE = '1/1/2007', CheckHistory.CHECK_DATE = '1/1/2008')) res = qry.all() I get one

[sqlalchemy] Re: object serializer

2009-09-22 Thread Michael Bayer
On Sep 22, 2009, at 8:34 AM, Julien Cigar wrote: Hello, I'm busy to make a kind of mapper exporter/serializer. My goal is to be able to serialize (in JSON, XML, ...) any Mapper object (including relations, etc) At the moment I've the following code (not finished at all) :

[sqlalchemy] Re: Inheritance + Pseudo-adjacency-list?

2009-09-22 Thread Michael Bayer
On Sep 22, 2009, at 11:59 AM, Kevin H wrote: I'm having some trouble developing my model, and was hoping someone on this list could help... Here's what I want: A BizEntity object A Person and Company object (both descended from BizEntity, using joined table inheritance) A

[sqlalchemy] Re: Beginner inheritance question

2009-09-22 Thread Michael Bayer
On Sep 22, 2009, at 3:42 AM, Iwan wrote: Hi there, this is perhaps a stupid question, but we can't get it figured out from the docs on inheritance... Is it possible in sqlalchemy to have a hierarchy of classes of which only the root class in the hierarchy is mapped to the database at