tori.db.session

class tori.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()

Flush all changes of the session.

persist(*entities)

Persist entities

Parameters:entities (type of list of type) – one or more entities
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:tori.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:tori.db.repository.Repository