CLI tool to import and export Metabase items (questions, dashboards, collections) across instances
Project description
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
~/.pypirc
file:
[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.
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 Distributions
Built Distribution
Hashes for metashovel-0.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c13b863e0490c11da589d051c6ad87ea99c8f356af90a65d65f7348a61a361b0 |
|
MD5 | e4f31c343f0af2d6dd758cf94d6e45d6 |
|
BLAKE2b-256 | a1d354d02b2bcdfa2ebc454fc2a8d4d56c4904ab5a50116d834cbf4144932b9c |