Home | Trees | Index | Help |
|
---|
Package bazaar :: Module core :: Class Bazaar |
|
object
--+
|
Bazaar
See Also: Broker
bazaar.motor.Motor
Method Summary | |
---|---|
Start the Bazaar ORM layer. | |
Add object to database. | |
Close database connection. | |
Commit pending database transactions. | |
Make new database connection. | |
Delete object from database. | |
Find objects of given class in database. | |
Get object with key. | |
Get list of application objects. | |
Initialize the Bazaar ORM layer. | |
Parse Bazaar ORM configuration. | |
Reload objects from database. | |
Rollback database transactions. | |
Set Bazaar ORM configuration. | |
Update object in database. | |
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) |
Instance Variable Summary | |
---|---|
brokers : Dictionary of brokers. | |
cls_list : List of application classes. | |
dbmod : Python DB API module. | |
dsn : Python DB API database source name. | |
motor : Database access object. |
Method Details |
---|
__init__(self,
cls_list,
config=None,
dsn='',
dbmod=None,
seqpattern=None)
|
add(self, obj)Add object to database.
|
closeDBConn(self)Close database connection.
|
commit(self)Commit pending database transactions. |
connectDB(self, dsn=None)Make new database connection. New database connection is created with specified database source name, which must conform to Python DB API Specification, i.e.:bazaar.connectDB('dbname=addressbook host=localhost port=5432 user=bird')It is possible to reconnect with previous database source name, too: bazaar.connectDB()
|
delete(self, obj)Delete object from database. Object's primary key value is set toNone .
|
find(self, cls, query, param=None, field=0)Find objects of given class in database. The method can be used in two ways. First, simple dictionary can be passed as query:# iterator is returned, so its next() method is used to get # the object apple = bazaar.find(Article, {'name': 'apple'}).next()Dictionary can contain objects as values, i.e.: bazaar.find(OrderItem, {'article': art})Second, it is possible to use full power of SQL language: # find orders and their articles if order amount is greater # than 50$ # find orders with the query query = """ select O.__key__ from "order" O left outer join order_item OI on O.__key__ = OI.order_fkey left outer join article A on OI.article_fkey = A.__key__ group by O.__key__ having sum(A.price) > 50 """ for ord in bzr.find(Order, query): print ord # show order for oi in ord.items: # show order's articles print oi.article
|
get(self, cls, key)Get object with key.
|
getObjects(self, cls)Get list of application objects. Only objects of specified class are returned.
|
init(self)Initialize the Bazaar ORM layer. |
parseConfig(self, config)Parse Bazaar ORM configuration.
|
reloadObjects(self, cls, now=False)Reload objects from database. If objects immediate reload is requested, then method returns iterator of objects being loaded from database.
|
rollback(self)Rollback database transactions. |
setConfig(self, config)Set Bazaar ORM configuration. |
update(self, obj)Update object in database.
|
Instance Variable Details |
---|
brokersDictionary of brokers. Brokers are mapped with its class application. |
cls_listList of application classes. |
dbmodPython DB API module. |
dsnPython DB API database source name. |
motorDatabase access object. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue May 10 18:27:30 2005 | http://epydoc.sf.net |