Skip to main content

Log Datasette events to a database table

Project description

datasette-events-db

PyPI Changelog Tests License

Log Datasette events to a database table

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-events-db

Usage

Once installed, all Datasette events will be logged to a table called datasette_events. This table will be created in the _internal database, but can be moved to another database using the following plugin configuration option:

plugins:
  datasette-events-db:
    database: my_database

The table will be created when Datasette starts up, if it does not already exist.

Table schema

create table if not exists datasette_events (
    id integer primary key,
    event text,
    created text,
    actor_id text,
    database_name text,
    table_name text,
    properties text -- JSON other properties
)
  • event is the text name of the event, for example create-table
  • created is an ISO formatted UTC timestamp
  • actor_id will be populated with the ID of the responsible actor, or null if not available
  • database_name will be the database property recorded by the event, if present
  • table_name will be the table property recorded by the event, if present
  • properties will be a JSON object containing any other properties recorded by the event

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-events-db
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-events-db-0.1a0.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

datasette_events_db-0.1a0-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page