class deker.collection.Collection(name, schema, adapter, factory, storage_adapter, collection_options=None)

Bases: SelfLoggerMixin, Serializer

Collection of Arrays or VArrays.

Collection is a high-level object for managing contents of a set of Arrays or VArrays united into one group under collection name and certain schema.


  • name: returns Collection name

  • array_schema: returns schema of embedded Arrays

  • varray_schema: returns schema of VArrays if applicable, else None

  • path: returns storage path to the Collection

  • options: returns chunking and compression options

  • as_dict: serializes main information about Collection into dictionary, prepared for JSON

API methods

  • create: according to main schema creates new Array or VArray of storage and returns its object

  • clear: according to main schema removes all VArrays and/or Arrays from the storage

  • delete: removes Collection and all its VArrays and/or Arrays from the storage

  • filter: filters Arrays or VArrays according to main schema and provided conditions

  • __iter__: according to the collection’s main schema iterates over all Arrays or VArrays in Collection, yields their objects

  • __str__: ordinary behaviour

  • __repr__: ordinary behaviour


Clear all Arrays and/or VArrays inside Collection.

Return type


create(primary_attributes=None, custom_attributes=None, id_=None)

Create Array or VArray according to collection main schema.

If VArraySchema is passed to Collection, all data management will go through VArrays as this method will create just VArrays (Arrays will be created automatically by VArray). Otherwise, only Arrays will be created.

  • primary_attributes (Optional[dict]) – Array or VArray primary attribute

  • custom_attributes (Optional[dict]) – Array or VArray custom attributes

  • idArray or VArray unique UUID string

  • id_ (Optional[str]) –

Return type

Union[Array, VArray]


Remove Collection and all its contents from the database.

Return type



Filter Arrays or VArrays by provided conditions.


filters (dict) – query conditions for filtering

Return type



Conditions for filtering are either Array or VArray id value:

{"id": "some_array_UUID_string"}

or full scope of primary attributes’ values:

{"primary_attr1_name": its value, "primary_attr2_name": its value, ...}
property array_schema: ArraySchema

Get collection ArraySchema.

property arrays: ArrayManager

Return manager for Arrays.

property as_dict: dict

Serialize Collection to dictionary.

property name: str

Get collection name.

property options: Optional[BaseCollectionOptions]

Get collection options: chunking, compression, etc.

property path: Path

Get Collection fs-path.

property varray_schema: Optional[VArraySchema]

Get collection VArraySchema.

property varrays: Optional[VArrayManager]

Return manager for VArrays.

  • name (str) –

  • schema (Union[ArraySchema, VArraySchema]) –

  • adapter (BaseCollectionAdapter) –

  • factory (BaseAdaptersFactory) –

  • storage_adapter (Type[BaseStorageAdapter]) –

  • collection_options (Optional[BaseCollectionOptions]) –