Write Datasette canned queries as plain SQL files
Project description
datasette-query-files
Write Datasette canned queries as plain SQL files.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-query-files
Or using pip
or pipenv
:
pip install datasette-query-files
pipenv install datasette-query-files
Usage
This plugin will look for canned queries in the filesystem, in addition any defined in metadata.
Let's say you're working in a directory called project-directory
, with a database file called my-project.db
. Start by creating a queries
directory with a my-project
directory inside it. Any SQL file inside that my-project
folder will become a canned query that can be run on the my-project
database. If you have a query-name.sql
file and a query-name.json
(or query-name.yml
) file in the same directory, the JSON file will be used as query metadata.
project-directory/
my-project.db
queries/
my-project/
query-name.sql # a query
query-name.yml # query metadata
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-query-files
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for datasette-query-files-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d6fd121b2418a34b3ff60aca49e4c78f55da841e073303ed34d7ec11237d81 |
|
MD5 | 8846875ca87b8f3b063b7dd3d0fe0f92 |
|
BLAKE2b-256 | f0dee5abaf6c0107f1ee170d6f5319bda95d4a1d38220a95b25d7c569ddba323 |
Hashes for datasette_query_files-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e60b5a3cd684cd6a2de93733d4a511c9fd900b8212860336f4c8f9f30da1b8be |
|
MD5 | 084e434e6740c1a2ef75ab127875b501 |
|
BLAKE2b-256 | 29cd339429168dfc0d7f168bff97e083c469e274872969507fde40ed4b54346c |