Library to integrate the MoJ data platform with the catalogue component.
Project description
Data platform catalogue
This library is part of the Ministry of Justice data platform.
It provides functionality to publish object metadata to the OpenMetadata data catalogue so that data products are discoverable.
How to install
To install the package using pip
, run:
pip install ministryofjustice-data-platform-catalogue
Topology
- Each moj data product is mapped to a database in the OpenMetadata catalogue
- We populate the schema level in openmetdata with a generic entry of
Tables
- Each table is mapped to a table in openmetadata
Example usage
from data_platform_catalogue import (
CatalogueClient, CatalogueMetadata,
DataProductMetadata, TableMetadata,
CatalogueError
)
client = CatalogueClient(
jwt_token="***",
api_uri="https://catalogue.apps-tools.development.data-platform.service.justice.gov.uk/api"
)
assert client.is_healthy()
data_product = DataProductMetadata(
name = "my_data_product",
description = "bla bla",
version = "v1.0.0",
owner = "7804c127-d677-4900-82f9-83517e51bb94",
email = "justice@justice.gov.uk",
retention_period_in_days = 365,
domain = "legal-aid",
dpia_required = False
)
data_product_schema = DataProductMetadata(
name = "Tables",
description = "All the tables contained within my_data_product",
version = "v1.0.0",
owner = "7804c127-d677-4900-82f9-83517e51bb94",
email = "justice@justice.gov.uk",
retention_period_in_days = 365,
domain = "legal-aid",
dpia_required = False
)
table = TableMetadata(
name = "my_table",
description = "bla bla",
column_types = {"foo": "string", "bar": "int"},
retention_period_in_days = 365
)
try:
service_fqn = client.create_or_update_database_service(name="data_platform")
database_fqn = client.create_or_update_database(metadata=data_product, service_fqn=service_fqn)
schema_fqn = client.create_or_update_schema(metadata=data_product_schema, database_fqn=database_fqn)
table_fqn = client.create_or_update_table(metadata=table, schema_fqn=schema_fqn)
except CatalogueError:
print("oh no")
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
Close
Hashes for ministryofjustice_data_platform_catalogue-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cbccc671bb4e22a15098e9bd631bee6cfd3520546499ff55cb84ef225ce64af |
|
MD5 | 522a2d40badc9d9a88dba95f1738b3b4 |
|
BLAKE2b-256 | 6d6ef197cd5cd7c9950f15fb70bcc9d26d6d558f4dbd6b493d3eef785af86554 |
Close
Hashes for ministryofjustice_data_platform_catalogue-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 463e92955ed27330fad877d5a3a552b0350a3c8b434e8a8475e27ce981a4bf5f |
|
MD5 | 1243697a9afb01dbf60060854703bbfe |
|
BLAKE2b-256 | dfead4c1016769af1c074128be85b2d4c5beb7f86a3e8716b1ffd674ed85c7d2 |