Skip to main content

datasette-query-files

PyPI Changelog Tests License

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

Release files for datasette-query-files 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-query-files 0.1.1
File Size Uploaded
datasette-query-files-0.1.1.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datasette-query-files 0.1.1
File Interpreter ABI Platform
datasette_query_files-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / datasette-query-files-0.1.1.tar.gz

Download URL datasette-query-files-0.1.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dfcd8880fb6b1126545a1fb21448e228963596ea877754527e7cb4edf95baad8
BLAKE2b-256 checksum
How to use checksums
72607b7e3466023744720fa446713dbb93a7987c778d77b5828796dd14484d63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / datasette_query_files-0.1.1-py3-none-any.whl

Download URL datasette_query_files-0.1.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6521e38682668f257bae09f78c02837f0a6158124c5cc10c0a125deb3d28676b
BLAKE2b-256 checksum
How to use checksums
af0731fb0cc38c202388c9d0076929e1ac7b9b3c2788e247248abdcbb4e74c52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page