Re: [Modeling-users] SQLite adaptor (more buglets)
Status: Abandoned
Brought to you by:
sbigaret
|
From: Mario R. <ma...@ru...> - 2003-08-01 10:43:43
|
1. Setting a .cfg, (that sets default adapter to SQLite, and uses the
interpolation feature of ConfigParser to set the data dir), pointing to
it via MDL_DB_CONNECTIONS_CFG, and running a number of
things gives an error, e.g:
% python tests/run.py -h
Traceback (most recent call last):
File "./run.py", line 38, in ?
import test_Attribute
File "./test_Attribute.py", line 37, in ?
from testPackages.AuthorBooks.Writer import Writer
File "./testPackages/AuthorBooks/__init__.py", line 8, in ?
model=Model.searchModel('AuthorBooks', mydir, verbose=0)
File "/Volumes/Other/modelingcvs/ProjectModeling/Modeling/Model.py",
line 234, in searchModel
model=loadModel(file)
File "/Volumes/Other/modelingcvs/ProjectModeling/Modeling/Model.py",
line 204, in loadModel
return ModelSet().addModelFromXML({'file': path})
File
"/Volumes/Other/modelingcvs/ProjectModeling/Modeling/ModelSet.py", line
196, in addModelFromXML
self.addModel(model)
File
"/Volumes/Other/modelingcvs/ProjectModeling/Modeling/ModelSet.py", line
160, in addModel
updateModelWithCFG(aModel, cfg_path)
File "/Volumes/Other/modelingcvs/ProjectModeling/Modeling/Model.py",
line 112, in updateModelWithCFG
defaults[key]=cp.get(model.name(), key)
File "/usr/lib/python2.2/ConfigParser.py", line 293, in get
raise InterpolationError(key, option, section, rawval)
ConfigParser.InterpolationError: Bad value substitution:
section: [AuthorBooks]
option : database
key : db_data_dir
rawval : %(db_data_dir)s/db_AuthorBooks.db
%
2. Creation of an SQLite db via the utility does not work (previosly
reported for pyms) also
for xml models. The command reports no error, but produces no output.
(It is of course
trivial to create a db in sqlite, by just doing 'sqlite file', but this
api should be consistent with
the other adaptors.
% mdl_generate_DB_schema.py --admin-dsn
localhost:StoreEmployees:dummy:dummy -C
StoreEmployees/MDL/model_StoreEmployees.xml
%
However, it should be noted that running the test scripts, e.g.:
% python ./test_EditingContext_Global.py -r -d SQLite
does create the SQLite db, except that it uses the SQLite.cfg in the
tests dir.
But, looking at the test scripts, the code used to create the db is
very different
than the code in the utility script.
3. After creating the db manually, to be able to proceed, generating the
schema does not work, as shown below. In the XML case, no error is
reported, but the db is not been modified at all:
% mdl_generate_DB_schema.py -R --admin-dsn
localhost:StoreEmployees:dummy:dummy pymodel_StoreEmployees.py
Drop Database FAILED
Reason:
exceptions.NameError
global name 'cnx' is not defined
File "/usr/bin/mdl_generate_DB_schema.py", line 74, in
databaseSchemaWithOptions
adaptor.dropDatabaseWithAdministrativeConnectionDictionary(administrativ
eConnectionDictionary, dropUser)
File
"/usr/lib/python2.2/site-packages/Modeling/DatabaseAdaptors/
AbstractDBAPI2AdaptorLayer/AbstractDBAPI2Adaptor.py", line 165, in
dropDatabaseWithAdministrativeConnectionDictionary
cnx,
cur=self.dbAPI_gimmeCnxAndCursorForDBAdmin(administrativeConnectionDicti
onary)
File
"/usr/lib/python2.2/site-packages/Modeling/DatabaseAdaptors/
SQLiteAdaptorLayer/SQLiteAdaptor.py", line 85, in
dbAPI_gimmeCnxAndCursorForDBAdmin
cnx.autocommit()
% mdl_generate_DB_schema.py -R --admin-dsn
localhost:StoreEmployees:dummy:dummy
StoreEmployees/MDL/model_StoreEmployees.xml
% sqlite /Volumes/Other/dev/sqlitedb/data/db_StoreEmployees.db
SQLite version 2.8.5
Enter ".help" for instructions
sqlite> .schema
sqlite> .exit
%
mario
|