Home | Trees | Index | Help |
|
---|
Package Pyblio :: Module Store :: Class Database |
|
object
--+
|
Database
Database
,
Database
A bibliographic database.
A database behaves like a dictionnary, linking akey
with
a record
. The records are typed, and
must follow the specifications of a Schema
.
>>> record = Record ()
>>> record ['title'] = Attribute.Text ('my title')
>>> # ...
>>> key = db.add (record)
When the record is added, a key
is generated which uniquely
references the record.
>>> r = db [k]
Alternatively, one can access all the records in a database in
random order:
>>> for key, record in db.entries.iteritems ():
>>> # do something with the record...
>>> record = db [key]
>>> ... # update the record
>>> db [key] = record
Attention: getting a record from the database returns a new copy at each access. Updating this copy does not change the stored value.
See Also: queries
Method Summary | |
---|---|
__init__(self)
| |
Get a record by key. | |
Update a record. | |
Insert a new entry in the database. | |
Partition the result set in a list of sets for every value taken by the specified field | |
Check for the existence of a key. | |
query(self,
query,
permanent)
| |
save(self)
| |
Check an entry for conformance against the Schema. | |
xmlread(self,
fd)
| |
Output a database in XML format | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Property Summary | |
---|---|
entries |
Class Variable Summary | |
---|---|
entries = Pyblio.Store.Database.entries | |
txo : a TxoGroup instance, containing all the
taxonomy definitions in the database. |
Method Details |
---|
__getitem__(self,
key)
Get a record by key.
|
__setitem__(self,
key,
record)
|
add(self, record, key=None)Insert a new entry in the database. New entries MUST be added with this method, not via an update with a hand-made Key. |
collate(self, rs, field)Partition the result set in a list of sets for every value taken by the specified field |
has_key(self, key)Check for the existence of a key.
|
validate(self, entry)Check an entry for conformance against the Schema. This method may modify the entry to normalize certain fields. |
xmlwrite(self, fd)Output a database in XML format |
Class Variable Details |
---|
txoaTxoGroup instance, containing all the
taxonomy definitions in the database. See TxoItem .
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Wed Feb 15 23:19:37 2006 | http://epydoc.sf.net |