>
> Found this Was having trouble but i guess this -->  
> https://docs.google.com/viewer?a=v&q=cache:v2lgkygxA_cJ:www.packtpub.com/sites/default/files/5467OS-Chapter-3-Database-Abstraction-Layer.pdf+&hl=en&pid=bl&srcid=ADGEESgEeuJ9YUV1Lwvy1CubPMg-92-ZM0Rtdvc14RQhuwGE32cSVmd-p35Tw21hW2R4PB9UcXbXLwTVrGRcthvusLvcdRDhnz8B2g-LsohKy64TyJcMX0yuCw5qiypnsPSxUyWHHoPT&sig=AHIEtbQPUlFmojpWCTBBJKHdwdR34aZeuw
>  
>
> explained it. DRY is broken however, which isn't a good thing as the 
> database gets bigger.
>

The DAL does not inspect the database -- you have to tell it about your 
models for it to know what's in the database. This is necessary because the 
models can include many attributes that are not part of the database, such 
as defaults, validators, computed fields, etc.

DRY is not broken. If you need to share models across applications, you can 
put them in a module and import them (only Linux, you can also use symbolic 
links to model files). If you don't need all the DAL-specific attributes of 
the models, you can also 
auto-import<http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables>the
 model definitions from another app via:

db = DAL('sqlite://storage.sqlite', folder='path/to/app/databases', 
auto_import=True))


Note, if multiple apps are sharing a database, make sure for any given 
table within that database that migrations are being handled by at most one 
of the applications (i.e., for each table, set migrate to False in all but 
one app).

Anthony

Reply via email to