passerine.db.session

Note

This page is automatically generated. If you don’t see anything, this means this sub-module is not meant to be used. If you really want to know what it is, please check out the source code at passerine/db/session.py.

class passerine.db.session.Session(driver)

Database Session

Parameters:
  • database_name – the database name
  • driver – the driver API
apply_relational_map(entity)

Wire connections according to the relational map

collection(entity_class)

Alias to repository()

Deprecated since version 2.2.

delete(*entities)

Delete entities

Parameters:entities (type of list of type) – one or more entities
flush(*args, **kwargs)

Flush all changes of the session.

See the flag from :method:`passerine.db.uow.UnitOfWork.commit`.

persist(*entities)

Persist entities

Parameters:entities (type of list of type) – one or more entities
query(query)

Query the data

Parameters:query (passerine.db.query.Query) – the query object
Returns:the list of matched entities
Return type:list
refresh(*entities)

Refresh entities

Parameters:entities (type of list of type) – one or more entities
register_class(entity_class)

Register the entity class

Parameters:entity_class (type) – the class of document/entity
Return type:passerine.db.repository.Repository

Note

This is for internal operation only. As it seems to be just a residual from the prototype stage, the follow-up investigation in order to remove the method will be for Tori 3.1.

repositories()

Retrieve the list of collections

Return type:list
repository(reference)

Retrieve the collection

Parameters:reference – the entity class or entity metadata of the target repository / collection
Return type:passerine.db.repository.Repository