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
- License: MIT
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.
Install with pip
The easiest and recommended way to install MetaData is using pip:
pip install metad
This will pull and install the latest stable release from PyPi.
If you want to install from source or contribute to the project please read the Contributing Guide.
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({
"id": "users",
"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("your_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-06-08)
- Populate data subtype in MySQL connector - Issue #11 by @k15z
- Modifying the schema to support non-unique table names - Issue #13 by @k15z
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
File details
Details for the file metad-0.0.2.tar.gz
.
File metadata
- Download URL: metad-0.0.2.tar.gz
- Upload date:
- Size: 54.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b93f28364b2fbe78a00b83c6930210625a364020a26ec22cf0d3d378c2961b1 |
|
MD5 | e303c7397035e67bedb624111f6a3726 |
|
BLAKE2b-256 | f2f20497a2ebff8062715f9bac398ee89304624462be348babe02f4cd44ad530 |
File details
Details for the file metad-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: metad-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04d93d243fb09f881a7ab5aa77ff9c13956030a10be039196e940b9f6dc4df60 |
|
MD5 | 2e456dac62ad1dc39623e81897a6437a |
|
BLAKE2b-256 | 5237912748222b9b1155aa94d5e9cbed0608e86c759c04c71a9d778431574679 |