Skip to content

cldellow/datasette-rewrite-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datasette-rewrite-sql

PyPI Changelog Tests License

Adds a rewrite_sql hook to Datasette.

Warning

This hook is added by monkey-patching Datasette. YOLO, but also, govern yourself accordingly.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-rewrite-sql

Usage

Write a hook like:

from datasette import hookimpl

@hookimpl
def rewrite_sql(sql):
  if sql == 'select 123':
    return 'select 234'

  return sql

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-rewrite-sql
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

About

A Datasette hook to inspect/rewrite the SQL users run.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published