passerine.db.common

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/common.py.

Author:Juti Noppornpitak <jnopporn@shiroyuki.com>
Stability:Stable
class passerine.db.common.ProxyCollection(session, origin, guide)

Proxy Collection

This collection is extended from the built-in class list, designed to only load the associated data whenever is required.

Parameters:

Note

To replace with criteria and driver

reload()

Reload the data list

Warning

This method is not recommended to be called directly. Use passerine.db.session.Session.refresh() on the owned object instead.

class passerine.db.common.ProxyFactory

Proxy Factory

This factory is to create a proxy object.

Parameters:
class passerine.db.common.ProxyObject(session, cls, object_id, read_only, cascading_options, is_reverse_proxy)

Proxy Collection

This class is designed to only load the entity whenever the data access is required.

Parameters:
  • session (passerine.db.session.Session) – the managed session
  • cls (type) – the class to map the data
  • object_id – the object ID
  • read_only (bool) – the read-only flag
  • cascading_options (list or tuple) – the cascading options
  • is_reverse_proxy (bool) – the reverse proxy flag
class passerine.db.common.PseudoObjectId(oid=None)

Pseudo Object ID

This class extends from bson.objectid.ObjectId.

This is used to differentiate stored entities and new entities.

class passerine.db.common.Serializer(max_depth=2)

Object Serializer for Entity

encode(data, stack_depth=0, convert_object_id_to_str=False)

Encode data into dictionary and list.

Parameters:
  • data – the data to encode
  • stack_depth – traversal depth limit
  • convert_object_id_to_str – flag to convert object ID into string