Skip to main content

A hierarchical representation for the structure of a relational database.

Project description

“DAI-Lab” An open source project from Data to AI Lab at MIT.

Development Status PyPI Shield Github Actions Shield Coverage Status

MetaData

This project aims to formally define a JSON schema which captures the structure of a relational database.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metad-0.0.2.tar.gz (54.6 kB view hashes)

Uploaded Source

Built Distribution

metad-0.0.2-py2.py3-none-any.whl (12.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page