Skip to main content

This is a python client that provides high level functions for interacting with liveramp's clean room.

Project description

Liveramp clean room

This library provides high level functions for interacting with liveramp's clean room API. Whilst users can directly interact with the API, we highly recommend the use of this client as it provides the following benefits:

  • Automatic fetching and efficient caching of access token
  • Automatic fetching of query status with exponential backoff
  • Provides a simple interface for fetching query result as a pandas dataframe
  • Provides user friendly interfaces for interacting with assets and associated permissions
  • Provides clear and intuitive error messages

Pre-Requisites

Credentials File

Use of the client requires an account configured with access to an organization within Data Hub. LiveRamp customers must use a service account for that purpose. A service account credential, in the form of a JSON file, can be generated by a LiveRamp employee and shared securely.

Installation

The Client is hosted on https://pypi.org/project/liveramp-clean-room/ and thus can be installed via

pip install liveramp_clean_room

Once installed the client be instantiated and added to your code as the example below shows:

from liveramp_clean_room import datahub


## Initialize a client
org_id = "00XXX0XXX0XXX00X0XXX000XXX"
credentials_file = "Path to service account file"
proxies = {
    'http': 'http://10.10.1.10:3128',
    'https': 'http://10.10.1.10:1080',
}

client = datahub.Client(org_id, credentials_file, proxies=proxies)

Where org_id is the id of an organization within DataHub and credentials_file is the JSON file location of your service account

proxies is an optional parameter that can be used to specify a proxy server for the client to use. If not specified, the client will not use a proxy server.

Running Queries

To run a query utilize the run_query function. DataHub supports the following query types:

  • Data Manipulation Language (DML)

    SELECT query

  • Data Definition Language (DDL)

    CREATE OR REPLACE FUNCTION/DROP FUNCTION), used to create or drop UDFs, a createdAssetID will be returned in the response.

Example: Run a query and get results

from liveramp_clean_room import datahub


org_id = "00XXX0XXX0XXX00X0XXX000XXX"
credentials_file = "Path to service account file"
client = datahub.Client(org_id, credentials_file)
query_id = client.run_query("select * from schema.mytable")


## Fetch result as a pandas dataframe
dataframe = client.get_result(query_id)

Note that the client returns a Pandas Dataframe

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

liveramp_clean_room-0.3.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

liveramp_clean_room-0.3.3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file liveramp_clean_room-0.3.3.tar.gz.

File metadata

  • Download URL: liveramp_clean_room-0.3.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for liveramp_clean_room-0.3.3.tar.gz
Algorithm Hash digest
SHA256 46755881c0cb01a681c510235473e2751831ab9f006450eb586c8290e257c573
MD5 c76d6255f37a58de1523b30e64ac9559
BLAKE2b-256 a474641d5bd65604566b8078babe355522b3a91f49c36fc65c7e64cc59a0547d

See more details on using hashes here.

File details

Details for the file liveramp_clean_room-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for liveramp_clean_room-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cd728618f28bba32eec88ed5c9fa3268979c2e9654cc6a56674f0a6cd89e522a
MD5 00f00b211739d238290c23ef106ac4ff
BLAKE2b-256 7d7893cd666af8766c2ee059424fa6cd2f86a92cf0145364248ec913d4ac9103

See more details on using hashes here.

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