Metashovel
Metashovel is a Metabase utility tool to mainly import/export questions and dashboards
Setup
Running from source
- Install Pipenv command in your system:
sudo apt install pipenv - Install dependencies from the root of this project directory:
pipenv install - Open shell with requirements loaded in a virtual environment:
pipenv shell
Configuration
Depending on subcommand, you configure the cli with:
- environment variables (mostly for credentials eg API keys, or access urls, eg. url to database with user, pass, hostname, db name)
- command line switches and arguments
Environment variables reference
- API keys and Database access urls
Metashovel uses the Metabase API. Define Metabase url, username and password with these variables:
METABASE_ENDPOINT- url of Metabase instance with scheme, eg: https://data.awesome.comMETABASE_AUTH_EMAIL- email for loginMETABASE_AUTH_PASSWORD- password for login
Usage
Metashovel has a set of subcommands, similar to git or heroku.
Export
metashovel export generates a JSON dump of all the data required to import the collections / dashboards / questions given in options.
The generated JSON is printed on standard output. It contains a property items with the list of objects that got exported, as well as a property mappings with information to translate ids that make sense only in the context of a Metabase instance (table ids, card ids, etc).
Options:
-c "Some collection"- Exports all the questions and dashboards contained in the named collection and its child collections. You should ensure that the dashboards refer only to questions contained within that collection, unless you plan to import the data within the same Metabase instance. The collection must exist.
Import
metashovel import reads a JSON dump generated by the export command and import the object into a Metabase instance.
Options:
-c "Some collection"- The name of the collection into which the objects should be imported. The collection must exist and be empty (no support for overwrite / merge at the moment).-j /path/to/file.json- The JSON file to import.
Package building
To build the package use python setup.py bdist_wheel.
To install the package locally:
pip install --upgrade dist/metashovel-0.1-py3-none-any.whl
To upload it to PyPI:
- Create a
~/.pypircfile:
[distutils]
index-servers=pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = pypi-username
- Use
python -m twine upload dist/*.
Contributing
TODO
Code Linting and Formatting
A pylint configuration is in pylintrc - configure your editor to run it automatically. Use black for formatting.
Release files for metashovel 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| metashovel-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / metashovel-0.4.1-py3-none-any.whl
| Download URL | metashovel-0.4.1-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb75a7b5c1c73cc8682d588c494ff7835b72919081b98512fc9b457d1babeea8
|
|
BLAKE2b-256 checksum How to use checksums |
9518ec09814982594f4a526643460bc59210986843c9589e6fbf235619d2d0c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.10
|