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 internal data platform catalogue is mapped to a database in the OpenMetadata catalogue
- Each data product is mapped to a schema
- Each table is mapped to a table
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()
catalogue = CatalogueMetadata(
name = "data_platform",
description = "All data products hosted on the data platform",
)
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
)
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=catalogue, service_fqn=service_fqn)
schema_fqn = client.create_or_update_schema(metadata=data_product, 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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd42284b880a75a501ed0819049f44e0afb6d54435e488b1a040f35d8068381a |
|
MD5 | 63e326c56fcce3cc58990e6d041db24d |
|
BLAKE2b-256 | a30885329a2331f7c14bd19893547654754bb2cc5cb83eecfdcf90ceaeacf607 |
Close
Hashes for ministryofjustice_data_platform_catalogue-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 852b565a96a45f8a263fa85f3c27cac61a6c7c417e28248f6182cd9fc718bb4b |
|
MD5 | 4dd90d37396ee6f05c8155a1352469e2 |
|
BLAKE2b-256 | 82f1e30b1412845bc769fa9c094246709eeefefa054a4b1fd065ac92fa384a99 |