okay, let me release something too. http://linuxteam.sistechnology.com/o2rm/sawrap0124.tar.bz2 i'm still looking for a name...
Basic idea of this SAwrapper is to be 3rd-level declarative translator
(SA has 2, non-declarative: orm->sqlpy, sqlpy->sql-dialect) and hide
the SA's specifics, i.e. OBJ->SAorm.
What's in now:
- all possible single relations of objects with <=2 levels
of inheritance are translated correctly
(tests/sa_ref_A_B_A_all.py and tests/test_A_B_inh_ref_all.py)
- some multilevel inheritances also can
be mapped - see doc/example.py - YMMV
- removed staticType stuff, will be released
separate + it's adapter/wrapper
- can generate a flat source-code for the prepared tables/mappers/etc
(well, mostly) - for testcases etc.
- needs sqlalchemy 0.3.4
what's to todo:
- 3+ level inheritances, as well as mixed-type inheritances,
do not work well (if at all)
- fix current and do more tests
- converting expressions into table.column-clauses
- many2* relations
basic usage:
- declare your types as inheriting sawrap.plainwrap.Type
(empty is ok)
- declare your class hierarchy starting off sawrap.plainwrap.Base
- declare attributes as instance/s of above Types
- declare references as instances of
sawrap.plainwrap.Type4SubStruct(name)
- choose DB_inheritance decomposition type at each class
- create fieldtypemap as a dictionary yourType:sqlalchemy.type
- create SAdb() instance
- sadb.bind( dict-of-all-classes, fieldtypemap, base_klas=yourbase)
-- declarative phase ends here - all info is available,
tables+mappers are built now.
- populate - create obj-instances, fill them, link them. Then make
session, and either use sadb.saveall( namespace-of-all-instances) or
save them one by one.
- query - use some of sadb.query_ALL_instances(),
sadb.query_BASE_instances(), query_SUB_instances(), then
do .select(..) over them
- have a drink... or two.
$ PYTHONPATH=sawrap/ python sawrap/doc/example.py
ciao
svil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---
example.py
Description: application/python
