The eXtremeDB Python wrapper has the
mcocomp
runtime compiled in, so the database schema can be defined in the form of text, just like a regular C API schema (mco
) file.(Please see the C API Users_Guide page for details on schema definition using the eXtremeDB DDL).
For example, the following is a simple database schema defined with a Python string:
schema = ''' #define uint4 unsigned<4> declare database opendb; class myclass { uint4 i4; }; '''To process and load this schema, call the
load_dictionary()
method:dict = exdb.load_dictionary(schema) dict <eXDB.Dictionary object at 0x1006e0790>The complete
load_dictionary()
method signature is quite complicated as it includes all the options for themcocomp
schema compiler:def load_dictionary(schema, nosort=False, dumpxml=False, genhpp=False, gencs=False, genjava=False, outDir='.', csNamespace='eXtremeDB', javaPackage='eXtremeDB', cmode1=False, genXmlMethods=False, genSql=False, largeDatabase=False, wcharSize=2, use_prefix=False, include_dir='.', compact=False, persistent=False, transient=False, suppress_api=False, debug=False):Only the
schema
argument itself is mandatory; all other arguments are optional and take the defaults indicated above.Persistent Databases
For persistent database applications the database classes are defined exactly as for in-memory databases. The difference between in-memory and persistent database applications in Python is in the argument
is_disk
passed to wrapper (exdb) methodopen_database()
(is_disk=True
for persistent media,is_disk=False
for in-memory) .