Skip to main content

Build Status

Adds an immutable audit trail to any NDB entity (including Expando-based models) built by the engineering team at Gain Compliance.

Data structures are optimized for write performance and query-ability at the expense of read performance and size of data. However, it is minimally invasive on the entity you add it to. It only adds two properties to the main entity totalling 32 characters and does not prevent you from doing normal get by key

You should read the below description of the data model (and especially entity groups) to ensure you don’t cause datastore contention problems with EGs that are too big

Features

  • Full history of an entity’s changes are recorded in a way that should be easily query-able

  • Audit history is atomically updated when the entity is put, even if all the entity’s properties are the same

  • Supports account (string), timestamp (datetime), data_hash (SHA-1 of properties) tracking

  • Strongly consistent retrieval of audit history

  • (WIP)Flexible “tagging” system to track progress along the chain of changes by a user, system, etc

  • (Future) “at revision” fetching of data

  • (Future) Diffing between revisions

  • (Future) Collision detection and merging

Data Model

For a given entity ‘E’ of kind ‘EKind’, ndb_audit will monitor all puts to entities who include the AuditMixin. Upon put a new Audit entity ‘A’ will be created which will be a complete copy of the entity. The entity A will have the following:

  • A will be of kind ‘Audit’

  • A will carry the namespace if the namespace_manager is used

  • A will contain a copy of every datastore property of E as it was when it was put

  • The parent entity of A will be E

  • The key of A will be ndb.Key(parent=, pairs=[(‘Audit’, )])

  • An attribute will be added to E called ‘d’, and a python property will be added to your class to access this value as data_hash. This value is added to your entity to allow caching based on the data_hash by all clients. At a given value for data_hash E will always be the same. The data_hash is a truncated SHA-1 hash of properties of the entity

  • An attribute will be added to E called ‘h’, and a python property will be added to your class to access this value as rev_hash. This value is added to your entity to allow you to track which revision the current entity is at. The rev_hash is a truncated SHA-1 hash of parent rev_hash, account string, and data_hash properties of the entity

  • No other properties will be added to E, instead you will have to fetch the audit entities – this is to keep overhead on E as small as possible

Usage

TODO

Metadata

Release files for ndb-audit 1.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndb-audit 1.1.10
File Size Uploaded
ndb_audit-1.1.10.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ndb-audit 1.1.10
File Interpreter ABI Platform
ndb_audit-1.1.10-py2-none-any.whl Python 2 none any Details

Total release size: 14.3 kB

Release files / ndb_audit-1.1.10.tar.gz

Download URL ndb_audit-1.1.10.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
215f82eaf5d52920a86e4d8fc636011f6a239e9dbbd18234ba212ebeb433cfce
BLAKE2b-256 checksum
How to use checksums
48a8288baac0db1b3d23df1ff74b51e4e9e309c87c96dab5104a531b2e76c371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ndb_audit-1.1.10-py2-none-any.whl

Download URL ndb_audit-1.1.10-py2-none-any.whl
Size 6.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
9209d7de0e5b8f3e331ab8f0df62d57690950029dd20ab7eabee4cbaac192aae
BLAKE2b-256 checksum
How to use checksums
b50e6c6eb971500cd84d90f8fc752dae061029a1e83fd72dc1ece7982842b77d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.10 This release

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

1.0.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page