Skip to main content

Unifier

Unifier is a Python package that provides a simple interface to interact with the Unifier API, allowing for Point-In-Time and streaming data access.

Features

  • Query the Unifier API for data.
  • Stream query results row by row as they arrive.
  • Retrieve data in JSON format.
  • Convert API responses into pandas DataFrames for easy data manipulation and analysis.
  • Efficiently replicate large datasets to local storage using rclone integration.
  • List and retrieve detailed metadata for datasets in the catalog.
  • Check which datasets you are entitled to, now or as of any past date or range.

Installation

You can install the package via pip:

pip install unifier

Requires Python 3.10 or later.

To use the Data Replication feature, it is recommended to install rclone for better performance. If rclone is not available, the package will automatically fall back to a native Python implementation for downloads.

Usage

Here's a basic example of how to use the unifier package:

from unifier import unifier

# Set your user and token
unifier.user = 'your_username'
unifier.token = 'your_api_token'

# Query the API. Arguments are passed by name and sent to the server as
# given; unifier.help() prints the parameters the server accepts.
response = unifier.query(name='your_dataset_name', limit=10)

# Stream rows as they arrive
for row in unifier.stream(name='your_dataset_name'):
    print(row)

# Convert the response to a DataFrame
df = unifier.get_dataframe(name='your_dataset_name')

print(df.head())

# Get list asof_date available for a dataset
dates_df = unifier.get_asof_dates(name='dataset_name')
print(dates_df.head())

# List the datasets in the catalog you are entitled to
datasets = unifier.list_data_catalog()
print(datasets)

# Include publicly available datasets alongside your entitled ones
all_datasets = unifier.list_data_catalog(show_all_datasets=True)

# Optionally limit the public datasets to a single product
product_datasets = unifier.list_data_catalog(
    show_all_datasets=True,
    product_type='product_name'
)

# Get detailed metadata for a specific dataset
details = unifier.get_dataset_details(name='dataset_name')
print(details)

# Look up a dataset you have no entitlement for, if it is publicly displayed
public_details = unifier.get_dataset_details(
    name='dataset_name',
    show_all_datasets=True
)

# List the datasets you are entitled to right now
entitled = unifier.list_entitled_datasets()
print(entitled)

# Entitlements as of a past date, or at any point across a range
entitled_then = unifier.list_entitled_datasets(date='2024-03-15')
entitled_range = unifier.list_entitled_datasets(
    from_date='2024-01-01',
    to_date='2024-06-30'
)

# Replicate a large dataset to a local folder
# Note: uses rclone if installed, otherwise uses native python download
unifier.replicate(
    name="large_dataset_name",
    target_location="./data/downloads",
    back_to="2023-01-01",    # Optional: fetch history back to this date
    up_to="2024-12-16",    # Optional: fetch history up to this date
    bandwidth_limit=20       # Optional: limit download speed to 20MB/s
)

Configuration

Before using the package, ensure you set your user and token attributes in the unifier class to authenticate with the API.

To send extra HTTP headers with every request (for example an Authorization header), set them on the class:

unifier.headers = {"Authorization": "Bearer <token>"}

All arguments are keyword-only. Positional arguments still work for now but are deprecated and print a warning naming the equivalent keyword call.

Error handling

Failures raise unifier.UnifierError — transport errors, non-200 answers, and responses that are not the expected JSON — from queries, streams, the catalog calls and replicate(). For the behavior of releases before 0.1.24 (log a warning and return an empty result, sending exactly the requests those releases sent), pass client_version=None per call, or set UNIFIER_CLIENT_VERSION_OVERRIDE=none in the environment (read when the client is imported) to keep that behavior process-wide with no code changes. stream() needs a server that supports streaming and is not available in that mode.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please read the contributing guidelines for more information.

Support

For support, please contact support@exponential-tech.ai.

Acknowledgments

  • Thanks to the team at Exponential Tech for their support and contributions.

Metadata

Release files for unifier 0.1.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unifier 0.1.25
File Size Uploaded Provenance Actions
unifier-0.1.25.tar.gz 44.4 kB Without provenance Details for unifier-0.1.25.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unifier 0.1.25
File Interpreter ABI Platform Actions
unifier-0.1.25-py3-none-any.whl Python 3 none any Details for unifier-0.1.25-py3-none-any.whl

Total release size: 87.4 kB

Release files / unifier-0.1.25.tar.gz

Download URL unifier-0.1.25.tar.gz
Size 44.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ac788df243423e7b114cdb02444c501d42b50dd30f7ee7ffee4c74e0098b100e
BLAKE2b-256 checksum
How to use checksums
1d14f658f29eec27096f9331aae8ebb5ca8f15bbf62ca8b0cf9b321c95da3c1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / unifier-0.1.25-py3-none-any.whl

Download URL unifier-0.1.25-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74b668554f0582f7cc546ede11816512eb15c3d56639f7c47e05d7fbbaa79998
BLAKE2b-256 checksum
How to use checksums
2ed6f5329b66d443dc1e1b2dce7e3a058c5a6034adc172e5ba5f7a723b90a6eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for unifier 0.1.25

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page