> All of that dbcook stuff scares me, though I think I can see > why you want it. heh. your model will look this way: --------------- import dbcook.usage.plainwrap as o2r class Text( o2r.Type): pass
class Itemtype( o2r.Base): name = Text() inherits = o2r.Association.Hidden( 'Itemtype', backref='progeny') own_features = o2r.Collection( 'Feature', backref='root_itemtype') class Feature( o2r.Base): name = Text() dependents = o2r.Association.Hidden( 'Feature', backref='determinants') class FeatureDependency( o2r.Base): dependent = o2r.Reference( Feature, backref='feature_dependencies_as_dependent') determinant = o2r.Reference( Feature, backref='feature_dependencies_as_determinant') #eo model... #sa-setup import sqlalchemy,sys meta = sqlalchemy.MetaData( sqlalchemy.create_engine('sqlite:///', echo= 'echo' in sys.argv )) # map attr-types to sa-column-types fieldtypemap = { Text: dict( type= sqlalchemy.String(100), ), } mybuild = o2r.Builder( meta, locals(), #just scan anything here that looks like subclass of Base fieldtypemap, generator =True #how this would look in plain sqlalchemy ) if mybuild.generator: print '========= generated SA set-up' print mybuild.generator.out print '========= eo generated SA set-up' -------------- thats it. u can run it and see generated sa-tables, sa-mappers etc. or just go ahead with actual usage. if u use the QueryX replacement, u can use the references, collections and associations in same way (a.somerel == c), even via filter_by, and use plain python funcs like lambda self: self.dependent.name.startswith('a') as .filter()s... and noone will notice if u change a 1:m or m:1 into m2m somewhere in the model. i still can't get why noone's using it. maybe it's too easy... and cannot see the cogwheels. > I will eventually need to wade into the waters of stricter > type checking and conversion on my tables, and that will get me > into a lot of similar concerns but hopefully not as deeply! type checking/conversion has nothing to do with dbcook, it's a separate layer, which has/needs its own dbcook-reflector. have fun, and sorry for the spam svil --~--~---------~--~----~------------~-------~--~----~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---