bento_meta.mdb.writeable

mdb.writeable: subclass of class:bento_meta.MDB to support writing to an MDB

Attributes

P

Classes

WriteableMDB

bento_meta.mdb.MDB subclass for writing to an MDB.

Functions

write_txn(...)

Decorate a query function to run a write transaction based on its query.

Module Contents

bento_meta.mdb.writeable.P
bento_meta.mdb.writeable.write_txn(func: collections.abc.Callable[Concatenate[WriteableMDB, P], tuple[str, dict[str, Any] | None]]) collections.abc.Callable[Concatenate[WriteableMDB, P], list[neo4j.Record]][source]

Decorate a query function to run a write transaction based on its query.

Query function should return a tuple (qry_string, param_dict).

Parameters:

func – The query function to decorate.

Returns:

Decorated function that executes a write transaction.

class bento_meta.mdb.writeable.WriteableMDB(uri: str | None = None, user: str | None = None, password: str | None = None)[source]

Bases: bento_meta.mdb.mdb.MDB

bento_meta.mdb.MDB subclass for writing to an MDB.

put_with_statement(qry: str, parms: dict[str, Any] | None = None) list[neo4j.Record][source]

Run an arbitrary write statement.

put_term_with_origin(term: bento_meta.objects.Term, commit: str = '', _from: int = 1) list[neo4j.Record][source]

Merge a bento-meta Term object, that has an Origin object set into an MDB.

If a new term is created, assign a random 6-char nanoid to it. The Origin must already be represented in the database.

Parameters:
  • term – Term object to merge.

  • commit – GitHub commit SHA1 associated with the term (if any).

  • _from – Source identifier.

Returns:

List of Records from the transaction.