A hierarchical representation for the structure of a relational database.
Project description
An open source project from Data to AI Lab at MIT.
MetaData
This project aims to formally define a JSON schema which captures the structure of a relational database.
- JSON Schema: https://data-dev.github.io/MetaData/schema.html
- Documentation: https://data-dev.github.io/MetaData
- Homepage: https://github.com/data-dev/MetaData
Install
Requirements
MetaData has been developed and tested on Python 3.5, 3.6, 3.7 and 3.8
Also, although it is not strictly required, the usage of a virtualenv is highly recommended in order to avoid interfering with other software installed in the system in which MetaData is run.
These are the minimum commands needed to create a virtualenv using python3.6 for MetaData:
pip install virtualenv
virtualenv -p $(which python3.6) MetaData-venv
Afterwards, you have to execute this command to activate the virtualenv:
source MetaData-venv/bin/activate
Remember to execute it every time you start a new console to work on MetaData!
Install from source
With your virtualenv activated, you can clone the repository and install it from
source by running make install
on the stable
branch:
git clone git@github.com:data-dev/MetaData.git
cd MetaData
git checkout stable
make install
Install for Development
If you want to contribute to the project, a few more steps are required to make the project ready for development.
Please head to the Contributing Guide for more details about this process.
Quickstart
In this short tutorial we will guide you through a series of steps that will help you getting started with MetaData.
Creating Metadata Objects
You can also help create Metadata objects from scratch. The following code will create a
MetaData
object, add a table, and then save it to a JSON file.
from metad import MetaData
metadata = MetaData()
metadata.add_table({
"name": "users",
"primary_key": "id",
"fields": [
{"name": "id", "data_type": "id"},
{"name": "name", "data_type": "text"}
],
})
Then, to export this object to a JSON file, you can run the following:
metadata.to_json("your_metadata.json")
Validating JSON Files
The core functionality of this library is to validate JSON files. The following code will load
the metadata file for the hello_world
dataset and validate it.
from metad import MetaData
metadata = MetaData.from_json("examples/hello_world/metadata.json")
metadata.validate()
What's next?
For more details about MetaData and all its possibilities and features, please check the documentation site.
History
0.0.1 (2020-05-22)
- First release on PyPI.
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 Distribution
Built Distribution
Hashes for metad-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d091f89aeaab53777d23d8fd4cdad1cd2819f3a7e53101ad59dffd554baed491 |
|
MD5 | 42f4f20f00cae7f9969b9bae9fc6b768 |
|
BLAKE2b-256 | 49beb9db78d1aba2d4a5fa61096e625045533ceee5e92800d2c76e2ee4f738e3 |