httk.store.mongo.entry_provider

Serve MongoDB-backed records through the neutral entry-provider contract.

Mongo entry identities are content identities rather than SQL row identities. Configured entry families are rendered through their Mongo stored-property plan; configured backing records are also accepted for the schema-derived provider surface used by the SQL provider’s parity tests.

Classes

StoreEntryProvider

Serve configured Mongo entry families or their concrete backings.

Functions

served_specs(schema, prefix)

Return the served (name, field spec, fulltype) triples.

auto_definition(entry_type, schema, prefix)

Build a definition for the JSON-able fields of one backing class.

Module Contents

httk.store.mongo.entry_provider.served_specs(schema, prefix)[source]

Return the served (name, field spec, fulltype) triples.

Parameters:
Returns:

One triple for every schema field with an OPTIMADE value type.

Return type:

list[tuple[str, httk.store.db.schema.FieldSpec, str]]

httk.store.mongo.entry_provider.auto_definition(entry_type, schema, prefix)[source]

Build a definition for the JSON-able fields of one backing class.

class httk.store.mongo.entry_provider.StoreEntryProvider(store, classes, *, definitions=None, prefix='_httk_', id_of=None, link_classes=())[source]

Bases: httk.core.EntryProvider

Serve configured Mongo entry families or their concrete backings.

classes maps public entry-type names to either configured entry-family classes or configured concrete backing classes. Family classes use the family’s MongoStoredPropertyPlan; backing classes use the same schema-derived property contract as the SQL provider. id_of receives (entry_type, sid, hydrated_record) and defaults to the record’s content identity.

entry_types()[source]

Return definitions for all served entry types.

property_keys(entry_type)[source]

Return public property names mapped to Mongo response keys.

records(entry_type)[source]

Yield JSON-able records for one served entry type.

relationships(entry_type)[source]

Return direct and link-derived relationships grouped by source id.