DataHub

Platform:

Channel Revision Published Runs on
latest/stable 31 17 Aug 2026
Ubuntu 22.04
latest/edge 36 27 Aug 2026
Ubuntu 22.04
juju deploy datahub-k8s

charms.datahub_k8s.v0.datahub_client

Library for the datahub_client relation.

This library provides the DatahubClientProvider and DatahubClientRequirer classes that handle the provider and the requirer sides of the datahub_client interface.

The interface lets a charm consume the DataHub GMS API as a dedicated DataHub service account. The provider (datahub-k8s) creates the service account, mints a Personal Access Token for it, stores the token in a Juju secret granted to the relation, and publishes the GMS URL alongside the secret ID. The requirer reads both and configures its workload.

Provider application databag (every field is a string):

gms-url               URL of the GMS API, reachable from the requirer.
                      "http://datahub-k8s.datahub-k8s.svc.cluster.local:8080"
secret-id             ID of a Juju secret whose `token` key holds the PAT.
                      "secret://3a214b83-9add-45e4-83af-665104bec574/akrgmperhr88jppn48ug"
service-account-urn   URN of the DataHub service account the token acts as.
                      "urn:li:corpuser:service_cb8b10ee-6bb0-4db6-9fc3-337eb588cc2c"

Token lifetime: the PAT does not expire and is not rotated on a schedule. It is tied to the service account, so removing the relation deletes the account and invalidates the token with it. The provider also re-mints a token whenever the service account it belongs to is gone, which is what makes revoking an account in DataHub a working way to force a new one.


class DatahubConnection

Everything a requirer needs to talk to DataHub GMS.

Attributes

gms_url
URL of the GMS API.
token
DataHub Personal Access Token to authenticate with.
service_account_urn
URN of the service account the token acts as.

class DatahubClientProvider

Provider side of the datahub_client relation.

Description

The library owns the databag layout; the charm owns the DataHub-side resources (service account, access token) and the Juju secret.

Methods

DatahubClientProvider. __init__( self , charm: CharmBase , relation_name: str )

Construct.

Arguments

charm

The charm instance.

relation_name

Name of the relation.

DatahubClientProvider. get_service_account_urn( self , relation: Relation )

Return the service account URN previously published on a relation.

Arguments

relation

The relation to read.

Returns

The URN, or None if nothing has been published yet.

DatahubClientProvider. get_secret_id( self , relation: Relation )

Return the token secret ID previously published on a relation.

Arguments

relation

The relation to read.

Returns

The Juju secret ID, or None if nothing has been published yet.

DatahubClientProvider. publish_connection( self , relation: Relation , gms_url: str , secret_id: str , service_account_urn: str )

Publish the connection details on a relation.

Arguments

relation

The relation to update.

gms_url

URL of the GMS API reachable from the requirer.

secret_id

ID of the Juju secret holding the access token.

service_account_urn

URN of the DataHub service account.

class DatahubClientRequirer

Description

Requirer side of the datahub_client relation. None

Methods

DatahubClientRequirer. __init__( self , charm: CharmBase , relation_name: str )

Construct.

Arguments

charm

The charm instance.

relation_name

Name of the relation.

Description

Return whether the relation currently exists. None

DatahubClientRequirer. get_connection( self )

Return the current DataHub connection details.

Returns

A DatahubConnection, or None while the provider has not published complete details or the token secret is not readable yet.