PyCool

PyCool is a python bindings package for COOL. PyCool allows full access to a COOL database via Python. It is part of the official COOL release since COOL_1_2_3.

The following is an example of how to use PyCool:

from PyCool import cool, coral
dbSvc = cool.DatabaseSvcFactory.databaseService()
print 'using software release', dbSvc.serviceVersion()

connectString = 'sqlite://;schema=COOLTEST.db;dbname=COOLTEST'

print 'recreating database'
dbSvc.dropDatabase( connectString )
db = dbSvc.createDatabase( connectString )

print 'setting up spec'
spec = cool.RecordSpecification()
spec.extend( 'i', cool.StorageType.Int32 )

data = cool.Record( spec )
data['i'] = 3

f = db.createFolder( "/folder", spec )
f.storeObject( 0, 5, data, 0 )
obj = f.findObject( 3, 0 )

print obj

Running this script will produce the output:

> python wiki.py
using software release 2.1.1
recreating database
setting up spec
[0,5[ (0) [i (Int32) : 3] 2007-04-22_14:21:48.565932000 GMT

-- SvenASchmidt - 14 Sep 2005

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2013-10-01 - AndreaValassi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Persistency All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback