Coder Social home page Coder Social logo

datasette-mutable-downloads's Introduction

datasette-mutable-downloads

PyPI Changelog Tests License

Enable downloading mutable databases.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-mutable-downloads

Usage

You can now download a mutable database on its database page, just as you can for immutable databases.

Example: https://dux.fly.dev/cooking

Notes

This is achieved by a somewhat gross monkeypatch of the DatabaseDownload view.

We detect if the database is mutable. If it is, we first create a copy via VACUUM INTO.

We then stream that file to the user, and delete it.

This requires SQLite 3.27.0 or newer (Feb 2019).

NOTE

The act of VACUUM INTO could be resource intensive if your database is large. If you expose your Datasette to the Internet, you may wish to restrict this to only authenticated users.

To do that, add a permissions block in your metadata.json:

"permissions": {
  "view-database-download": {
    "gh_id": "*"
  }
}

Development

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

cd datasette-mutable-downloads
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.