datasette-events-db


Namedatasette-events-db JSON
Version 0.1a0 PyPI version JSON
download
home_page
SummaryLog Datasette events to a database table
upload_time2024-02-08 17:34:15
maintainer
docs_urlNone
authorSimon Willison
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datasette-events-db

[![PyPI](https://img.shields.io/pypi/v/datasette-events-db.svg)](https://pypi.org/project/datasette-events-db/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-events-db?include_prereleases&label=changelog)](https://github.com/datasette/datasette-events-db/releases)
[![Tests](https://github.com/datasette/datasette-events-db/actions/workflows/test.yml/badge.svg)](https://github.com/datasette/datasette-events-db/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-events-db/blob/main/LICENSE)

Log Datasette events to a database table

## Installation

Install this plugin in the same environment as Datasette.
```bash
datasette install datasette-events-db
```
## Usage

Once installed, all [Datasette events](https://docs.datasette.io/en/latest/events.html) 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:

```yaml
plugins:
  datasette-events-db:
    database: my_database
```

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

## Table schema

```sql
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:
```bash
cd datasette-events-db
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "datasette-events-db",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/47/08/510134b505f29b8500fb92f637df1185b3d68df5eb5ab5c8c13118aedcbf/datasette-events-db-0.1a0.tar.gz",
    "platform": null,
    "description": "# datasette-events-db\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-events-db.svg)](https://pypi.org/project/datasette-events-db/)\n[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-events-db?include_prereleases&label=changelog)](https://github.com/datasette/datasette-events-db/releases)\n[![Tests](https://github.com/datasette/datasette-events-db/actions/workflows/test.yml/badge.svg)](https://github.com/datasette/datasette-events-db/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-events-db/blob/main/LICENSE)\n\nLog Datasette events to a database table\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n```bash\ndatasette install datasette-events-db\n```\n## Usage\n\nOnce installed, all [Datasette events](https://docs.datasette.io/en/latest/events.html) 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:\n\n```yaml\nplugins:\n  datasette-events-db:\n    database: my_database\n```\n\nThe table will be created when Datasette starts up, if it does not already exist.\n\n## Table schema\n\n```sql\ncreate table if not exists datasette_events (\n    id integer primary key,\n    event text,\n    created text,\n    actor_id text,\n    database_name text,\n    table_name text,\n    properties text -- JSON other properties\n)\n```\n- `event` is the text name of the event, for example `create-table`\n- `created` is an ISO formatted UTC timestamp\n- `actor_id` will be populated with the ID of the responsible actor, or `null` if not available\n- `database_name` will be the `database` property recorded by the event, if present\n- `table_name` will be the `table` property recorded by the event, if present\n- `properties` will be a JSON object containing any other properties recorded by the event\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd datasette-events-db\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Log Datasette events to a database table",
    "version": "0.1a0",
    "project_urls": {
        "CI": "https://github.com/datasette/datasette-events-db/actions",
        "Changelog": "https://github.com/datasette/datasette-events-db/releases",
        "Homepage": "https://github.com/datasette/datasette-events-db",
        "Issues": "https://github.com/datasette/datasette-events-db/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a2943b1a4096799864f109c4bcb88cfce7dd692092d47a95c9913f02f78ac30",
                "md5": "917b4adf4f595515d9a9538cb179badf",
                "sha256": "6bcdf9667a8b654bcc79fc418f0bfd0dfdaa807a33ac6c03a9979ff9acd7e117"
            },
            "downloads": -1,
            "filename": "datasette_events_db-0.1a0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "917b4adf4f595515d9a9538cb179badf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7453,
            "upload_time": "2024-02-08T17:34:11",
            "upload_time_iso_8601": "2024-02-08T17:34:11.674955Z",
            "url": "https://files.pythonhosted.org/packages/3a/29/43b1a4096799864f109c4bcb88cfce7dd692092d47a95c9913f02f78ac30/datasette_events_db-0.1a0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4708510134b505f29b8500fb92f637df1185b3d68df5eb5ab5c8c13118aedcbf",
                "md5": "f930e3fe629739fddb2205115ad8f7f1",
                "sha256": "02f58008e43f3b411cc031c6561987093d422ac240b3d3051fafc908a6675444"
            },
            "downloads": -1,
            "filename": "datasette-events-db-0.1a0.tar.gz",
            "has_sig": false,
            "md5_digest": "f930e3fe629739fddb2205115ad8f7f1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7610,
            "upload_time": "2024-02-08T17:34:15",
            "upload_time_iso_8601": "2024-02-08T17:34:15.016485Z",
            "url": "https://files.pythonhosted.org/packages/47/08/510134b505f29b8500fb92f637df1185b3d68df5eb5ab5c8c13118aedcbf/datasette-events-db-0.1a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 17:34:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "datasette",
    "github_project": "datasette-events-db",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datasette-events-db"
}
        
Elapsed time: 0.28468s