Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datasette/datasette-create-view
Create a SQL view from a query
https://github.com/datasette/datasette-create-view
Last synced: 2 months ago
JSON representation
Create a SQL view from a query
- Host: GitHub
- URL: https://github.com/datasette/datasette-create-view
- Owner: datasette
- License: apache-2.0
- Created: 2024-03-07T03:22:29.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-07T05:07:44.000Z (11 months ago)
- Last Synced: 2024-11-11T18:04:58.934Z (2 months ago)
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```
This plugin requires [Datasette 1.0a12](https://docs.datasette.io/en/latest/changelog.html#a12-2024-02-29) or later.## 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
```