normlite.txmodel.operations

Provide a protocol for commit operation and all proxy server operations.

Added in version 0.6.0.

Module Contents

class normlite.txmodel.operations.Operation[source]

Bases: Protocol

Interface for change requests that process data in the context of a transaction.

Change requests follow a well-defined protocol to accomplish their task of modifying data in a consistent way. Each operation must define:

  • stage(): These are the pre-commit activities to validate data prior to committing them.

  • do_commit(): All activities to commit data to the database.

  • do_rollback(): All activities to revert changes committed prior to this failed change.

stage() None[source]

Stage and validate the data to be committed.

do_commit() None[source]

Perform the commit activities associated with this operation.

do_rollback() None[source]

Perform the rollback activities associated to this operation.

get_result() dict[source]

Return the result of the last executed Operation.do_commit() or Operation.do_rollback().

class normlite.txmodel.operations.StagedInsert(notion: normlite.notion_sdk.client.AbstractNotionClient, page_payload: dict, tx_id: str)[source]

Bases: Operation

Operation to create a new page in a Notion database.

notion
page_payload
tx_id
page_id = None
_result = None
stage() None[source]

Stage and validate the data to be committed.

do_commit() None[source]

Perform the commit activities associated with this operation.

do_rollback() None[source]

Perform the rollback activities associated to this operation.

get_result() dict[source]

Return the result of the last executed Operation.do_commit() or Operation.do_rollback().

class normlite.txmodel.operations.StagedSelect(notion: normlite.notion_sdk.client.AbstractNotionClient, payload: dict, tx_id: str)[source]

Bases: Operation

Operation to query the database.

notion
payload
tx_id
_result = None
stage() None[source]

Stage and validate the data to be committed.

do_commit() None[source]

Perform the commit activities associated with this operation.

do_rollback()[source]

Nothing to rollback, SELECT is non mutating.

get_result() dict[source]

Return the result of the last executed Operation.do_commit() or Operation.do_rollback().

class normlite.txmodel.operations.StagedCreateTable(notion: normlite.notion_sdk.client.AbstractNotionClient, payload: dict, tx_id: str)[source]

Bases: Operation

Operation to create a new table.

notion
payload
tx_id
database_id = None
_result = None
stage()[source]

Stage and validate the data to be committed.

do_commit() None[source]

Perform the commit activities associated with this operation.

do_rollback() None[source]

Perform the rollback activities associated to this operation.