Metadata-Version: 2.1
Name: datasette-create-view
Version: 0.1
Summary: Create a SQL view from a query
Author: Simon Willison
License: Apache-2.0
Project-URL: Homepage, https://github.com/datasette/datasette-create-view
Project-URL: Changelog, https://github.com/datasette/datasette-create-view/releases
Project-URL: Issues, https://github.com/datasette/datasette-create-view/issues
Project-URL: CI, https://github.com/datasette/datasette-create-view/actions
Classifier: Framework :: Datasette
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: datasette >=1.0a12
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-asyncio ; extra == 'test'

# datasette-create-view

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

Create a SQL view from a query

## Installation

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

Users with the `create-table` permission will get a new menu item on the query results page offering to save the query as a view.

This option will only show for SQL queries that do not use `:named` parameters.

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd datasette-create-view
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
```
