Thread: [Modeling-users] Questions and suggestions
Status: Abandoned
Brought to you by:
sbigaret
From: Ernesto R. <er...@si...> - 2003-06-08 19:45:19
|
Hi, for Sebastién: * I can only do a comparison matrix with the best-known Python OR-Mappers because I haven't done any serious work with them. The major difference is that the other ORMs have no query language. In Middlekit, e.g., you can use SQL conditions, but the may not be db-independent. Strange that there is no implementation of OQL. To all: after working through the docs (v.0.9-pre7) (still didn't try the package) here are some points: * Dependencies: The PyPgSQL and PyGreSQL names are interchanged. Also, should be pypgsql * What functions are used from 4Suite? (It's 6MB to download for Windows.) Isn't it enough to use PyXML? * Installation is a bit complicated, because of the dependencies. What chances are there to create a complete install file (perhaps excluding db-adaptors) for some of the mile-stone versions? * Although the inheritance mapping is described, I can't see out of the docs if a relations may map to different tables (say Animals and Humans). This is because the class has to be stored with the foreign key. (See ids.) About ids and inheritance: * Would it be a good idea to specify all object pointers as type ObjectId in the XML-Model file and tell how this is mapped to the DB in the adaptor? (integer is enough?) * May be ObjectIds should be unique throughout the database? (A seperate procedure would dispatch new objectids, using some high:low algorithm.) See next point. Also good for replication. * Either the foreign class (id) has to be stored with each foreign key, or the object id contains the class id as part of it (MiddleKit does this). * How would this be treated in queries? Would a query return objects of several tables? (This may require extra queries. A simple INNER JOIN wouldn't do it.) Inheritance makes it real complicated, and in practice, may not be so important, depending on the object-model design. More to come, Erny |
From: Sebastien B. <sbi...@us...> - 2003-06-10 17:31:40
|
Ernesto Revilla <er...@si...> wrote: > Hi, >=20 > for Sebasti=E9n: > * I can only do a comparison matrix with the best-known Python OR-Mappers > because I haven't done any serious work with them. The major difference is > that the other ORMs have no query language. In Middlekit, e.g., you can u= se > SQL conditions, but the may not be db-independent.=20 Ok.=20 > Strange that there is no implementation of OQL. Well, it's not *that* known (at least to me;). If you have some good pointe= rs for it I'd have a closer look --I've never played with that. > To all: > after working through the docs (v.0.9-pre7) (still didn't try the package) > here are some > points: >=20 > * Dependencies: The PyPgSQL and PyGreSQL names are interchanged. Also, > should be pypgsql Yes, this has been changed with 0.9pre8 --hopefully this is now okay. If you find more occurences of such errors, please report again. > * What functions are used from 4Suite? (It's 6MB to download for Windows.) > Isn't it enough to use PyXML? Yes it is! 0.9pre8 removed 4Suite from its dependencies --but I forgot to include that in the announcement. > * Installation is a bit complicated, because of the dependencies. What > chances are there to create a complete install file (perhaps excluding > db-adaptors) for some of the mile-stone versions? There are some chances, if only I could find a script we formerly used to install the whole stuff. Maybe some of us here still have it at hand? (hey, these ones know who they are ;) > * Although the inheritance mapping is described, I can't see out of the d= ocs > if a relations may map to different tables (say Animals and Humans). This= is > because the class has to be stored with the foreign key. (See ids.) >=20 > About ids and inheritance: > * Would it be a good idea to specify all object pointers as type ObjectId= in > the XML-Model file and tell how this is mapped to the DB in the adaptor? > (integer is enough?) >=20 > * May be ObjectIds should be unique throughout the database? (A seperate > procedure would dispatch new objectids, using some high:low algorithm.) S= ee > next point. Also good for replication. >=20 > * Either the foreign class (id) has to be stored with each foreign key, or > the object id contains the class id as part of it (MiddleKit does this). >=20 > * How would this be treated in queries? Would a query return objects of > several tables? (This may require extra queries. A simple INNER JOIN > wouldn't do it.) >=20 > Inheritance makes it real complicated, and in practice, may not be so > important, depending on the object-model design. I'm not sure to fully understand what you mean here, pardon me if my answer= is off-topic. 1. If you're looking for an 'ObjectId', globalID() is for you. A GlobalID uniquely identifies an object. You can get it with ec.globalIDForObject(object) It answers to: entityName() (mapped to a class in the model) keyValues (dictionary with pks as keys and their corresponding values) In particular, if two different objects refer to the same row in the database, they have the same GlobalID. 2. Suppose you have the following model: Address <<-toAddresses---toEmployee-> Employee ^ / \ T | +--------------+ | | Executive SalesClerk * An address object can be linked to either an Employee, an Executive= or a SalesClerk instance * An address.toEmployee() will retrieve the right object (being an instances of one of those three classes) * when fetching, you can specify whether you want to fetch a single class or its inheritance tree as well. Compare this, based on the t= est database and model StoreEmployees: >>> from StoreEmployees import Address >>> from Modeling.FetchSpecification import FetchSpecification as FS >>> from Modeling.EditingContext import EditingContext as EC >>> from Modeling.Qualifier import qualifierWithQualifierFormat as qWQF >>>=20 >>> ec =3D EC() >>> q =3D qWQF('toAddresses.zipCode like "4%"') >>> fs =3D FS('Employee', qualifier=3Dq) >>> fs_deep =3D FS('Employee', qualifier=3Dq, deepFlag=3D1) # Note the deep= Flag >>> ec.objectsWithFetchSpecification(fs) [] >>> [(o.getFirstName(),o.getLastName()) ... for o in ec.objectsWithFetchSpecification(fs_deep)] [('John Jr.', 'Cleese'), ('Jeanne', 'Cleese'), ('John', 'Cleese')] So the answer to your question: > * How would this be treated in queries? Would a query return objects of > several tables? (This may require extra queries. A simple INNER JOIN > wouldn't do it.) is clearly yes! However you're right, the documentation lacks even a basic example and explanantions for this. Does this answers your questions? Feel free to ask for more. -- S=E9bastien. |
From: Jerome K. <Jer...@fi...> - 2003-06-10 18:18:53
|
On Tue, Jun 10, 2003 at 07:30:10PM +0200, Sebastien Bigaret wrote: > > * Installation is a bit complicated, because of the dependencies. What > > chances are there to create a complete install file (perhaps excluding > > db-adaptors) for some of the mile-stone versions? > > There are some chances, if only I could find a script we formerly used to > install the whole stuff. Maybe some of us here still have it at hand? (hey, > these ones know who they are ;) > I think this is for me :) .. And yes, i have an old copy (which i have never test) I sent it off-list Bye Bye |
From: Sebastien B. <sbi...@us...> - 2003-06-12 11:41:07
|
I wrote: > >>> q =3D qualifierWithQualifierFormat('toAddresses.zipCode like "4%"') Ooops... such a qualifier should normally match '4\%', NOT '4' and any characters after. Hence: 1. to match character '4' followed by any characters, the qualifier string should be: 'toAddresses.zipCode like "4*"' =20 2. this was a bug in the postgresql adaptor layer: postgresql interprets backslashes, so escaping '%' should be like: '\\%', NOT '\%'. This bug is now corrected on CVS and will be in next release. (it affects neither mysql nor sqlite) -- S=E9bastien. |