datasette-edit-schema


Namedatasette-edit-schema JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://github.com/simonw/datasette-edit-schema
SummaryDatasette plugin for modifying table schemas
upload_time2023-11-04 21:23:29
maintainer
docs_urlNone
authorSimon Willison
requires_python>=3.7
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datasette-edit-schema

[![PyPI](https://img.shields.io/pypi/v/datasette-edit-schema.svg)](https://pypi.org/project/datasette-edit-schema/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-edit-schema?include_prereleases&label=changelog)](https://github.com/simonw/datasette-edit-schema/releases)
[![Tests](https://github.com/simonw/datasette-edit-schema/workflows/Test/badge.svg)](https://github.com/simonw/datasette-edit-schema/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-edit-schema/blob/master/LICENSE)

Datasette plugin for modifying table schemas

## Features

* Add new columns to a table
* Rename columns in a table
* Modify the type of columns in a table
* Re-order the columns in a table
* Rename a table
* Delete a table
* Change the primary key of a table to another column containing unique values
* Update the foreign key constraints on a table
* Add an index (or unique index) to a column on a table
* Drop an index from a table

## Installation

Install this plugin in the same environment as Datasette.
```bash
pip install datasette-edit-schema
```
## Usage

Navigate to `/-/edit-schema/dbname/tablename` on your Datasette instance to edit a specific table.

Use `/-/edit-schema/dbname` to create a new table in a specific database.

By default only [the root actor](https://datasette.readthedocs.io/en/stable/authentication.html#using-the-root-actor) can access the page - so you'll need to run Datasette with the `--root` option and click on the link shown in the terminal to sign in and access the page.

## Permissions

The `edit-schema` permission governs access. You can use permission plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) to grant additional access to the write interface.

These permission checks will call the `permission_allowed()` plugin hook with three arguments:

- `action` will be the string `"edit-schema"`
- `actor` will be the currently authenticated actor - usually a dictionary
- `resource` will be the string name of the database

## Screenshot

![datasette-edit-schema interface](https://raw.githubusercontent.com/simonw/datasette-edit-schema/main/datasette-edit-schema.png)

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd datasette-edit-schema
python3 -mvenv venv
source venv/bin/activate
```
Or if you are using `pipenv`:
```bash
pipenv shell
```
Now install the dependencies and tests:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/simonw/datasette-edit-schema",
    "name": "datasette-edit-schema",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5c/b5/d1398bf4f856585bddebeae6f3439d46d477e062e6db146095b74d89178f/datasette-edit-schema-0.7.1.tar.gz",
    "platform": null,
    "description": "# datasette-edit-schema\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-edit-schema.svg)](https://pypi.org/project/datasette-edit-schema/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-edit-schema?include_prereleases&label=changelog)](https://github.com/simonw/datasette-edit-schema/releases)\n[![Tests](https://github.com/simonw/datasette-edit-schema/workflows/Test/badge.svg)](https://github.com/simonw/datasette-edit-schema/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-edit-schema/blob/master/LICENSE)\n\nDatasette plugin for modifying table schemas\n\n## Features\n\n* Add new columns to a table\n* Rename columns in a table\n* Modify the type of columns in a table\n* Re-order the columns in a table\n* Rename a table\n* Delete a table\n* Change the primary key of a table to another column containing unique values\n* Update the foreign key constraints on a table\n* Add an index (or unique index) to a column on a table\n* Drop an index from a table\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n```bash\npip install datasette-edit-schema\n```\n## Usage\n\nNavigate to `/-/edit-schema/dbname/tablename` on your Datasette instance to edit a specific table.\n\nUse `/-/edit-schema/dbname` to create a new table in a specific database.\n\nBy default only [the root actor](https://datasette.readthedocs.io/en/stable/authentication.html#using-the-root-actor) can access the page - so you'll need to run Datasette with the `--root` option and click on the link shown in the terminal to sign in and access the page.\n\n## Permissions\n\nThe `edit-schema` permission governs access. You can use permission plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) to grant additional access to the write interface.\n\nThese permission checks will call the `permission_allowed()` plugin hook with three arguments:\n\n- `action` will be the string `\"edit-schema\"`\n- `actor` will be the currently authenticated actor - usually a dictionary\n- `resource` will be the string name of the database\n\n## Screenshot\n\n![datasette-edit-schema interface](https://raw.githubusercontent.com/simonw/datasette-edit-schema/main/datasette-edit-schema.png)\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd datasette-edit-schema\npython3 -mvenv venv\nsource venv/bin/activate\n```\nOr if you are using `pipenv`:\n```bash\npipenv shell\n```\nNow install the dependencies and tests:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "Datasette plugin for modifying table schemas",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://github.com/simonw/datasette-edit-schema"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9e64301d73526617ca1f7b90b7e275fd0547d8c297228b68ebdbf7c9c45fa0b",
                "md5": "34402e480af5b3626bc8f24463f2521a",
                "sha256": "060dbd8d0c96038aafd7d8efcb5efdf98f785edd4603eca555678e47f5efcbf1"
            },
            "downloads": -1,
            "filename": "datasette_edit_schema-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "34402e480af5b3626bc8f24463f2521a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 65451,
            "upload_time": "2023-11-04T21:23:28",
            "upload_time_iso_8601": "2023-11-04T21:23:28.515352Z",
            "url": "https://files.pythonhosted.org/packages/f9/e6/4301d73526617ca1f7b90b7e275fd0547d8c297228b68ebdbf7c9c45fa0b/datasette_edit_schema-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cb5d1398bf4f856585bddebeae6f3439d46d477e062e6db146095b74d89178f",
                "md5": "7da6d26c2fa7ff09ebab22ec0a0395c5",
                "sha256": "e7de83533bbb441ed0f392b2cae9a2871931be917f69cbad1d60c79cac1dbe08"
            },
            "downloads": -1,
            "filename": "datasette-edit-schema-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7da6d26c2fa7ff09ebab22ec0a0395c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 67798,
            "upload_time": "2023-11-04T21:23:29",
            "upload_time_iso_8601": "2023-11-04T21:23:29.636714Z",
            "url": "https://files.pythonhosted.org/packages/5c/b5/d1398bf4f856585bddebeae6f3439d46d477e062e6db146095b74d89178f/datasette-edit-schema-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-04 21:23:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "datasette-edit-schema",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datasette-edit-schema"
}
        
Elapsed time: 0.36724s