Skip to main content

YTsaurus Python Client

A lightweight Python helper library for day-to-day work with YTsaurus - https://ytsaurus.tech YQL and pandas DataFrames

The project wraps common analytics workflows into a small, readable API:

  • run YQL queries and return results as pandas.DataFrame
  • read large query outputs through temporary YTsaurus tables
  • write YQL results directly into YTsaurus tables
  • upload pandas DataFrames into YTsaurus tables

This repository is designed as a clean portfolio-friendly version of the client: no company-specific hosts, pools, paths, tokens, or internal links are hardcoded

Installation

pip install ytsaurus_python_client
pip install -e .

Requirements

  • Python 3.9+
  • pandas
  • numpy
  • YTsaurus Python client with yt.wrapper

Configuration

The library is configured through environment variables or explicit constructor arguments.

Variable Purpose Default
YT_PROXY YTsaurus proxy host empty
YT_TOKEN_PATH Path to a local token file ~/.yt/token
YT_DEFAULT_TEMP_DIR Temp folder for large YQL result materialization //tmp/ytsaurus-python-client
YT_POOL Optional YQL pool pragma unset
YT_UI_BASE_URL Optional web UI base URL used only for printed links unset

Example:

export YT_PROXY="your-ytsaurus-proxy.example.com"
export YT_TOKEN_PATH="$HOME/.yt/token"
export YT_DEFAULT_TEMP_DIR="//home/your-login/tmp"

Quick start

Run a YQL query

from ytsaurus_python_client import YTsaurusHook

hook = YTsaurusHook(
    yt_proxy="your-ytsaurus-proxy.example.com",
    yt_query_result_temp_dir="//home/your-login/tmp",
)

df = hook.yql("""
SELECT
    1 AS id,
    "hello" AS value;
""")

print(df)

Materialize a large YQL result into a temp table and read it in chunks

df = hook.yql_unlim(
    """
    SELECT *
    FROM `//home/your-login/large_table`;
    """,
    chunksize=500_000,
)

Upload a DataFrame to YTsaurus

import pandas as pd

from ytsaurus_python_client import YTsaurusHook

hook = YTsaurusHook(yt_proxy="your-ytsaurus-proxy.example.com")

df = pd.DataFrame({"id": [1, 2], "name": ["Alice", "Bob"]})
schema = hook.generate_yt_schema(df)

hook.upload_df_to_yt(
    df=df,
    yt_path="//home/your-login/users",
    schema=schema,
    overwrite=True,
)

Public API

from ytsaurus_python_client import (
    YTsaurusHook,
    DOYTHook,          # backward-compatible alias
)

Design notes

  • Defaults are intentionally generic and safe for public repositories
  • Secrets are never hardcoded. Use YT_TOKEN, YT_TOKEN_PATH, or explicit arguments
  • Printed YTsaurus UI links are optional and controlled by YT_UI_BASE_URL
  • YQL pragmas can be provided through query_pragma_config or environment variables such as YT_POOL
  • DOYTHook is kept as a backward-compatible alias; new code should prefer YTsaurusHook

License

MIT © 2026 Aleksey Voronko

Release files for ytsaurus-python-client 0.2.0

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

Source distribution (sdist)

Source distribution for ytsaurus-python-client 0.2.0
File Size Uploaded
ytsaurus_python_client-0.2.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ytsaurus-python-client 0.2.0
File Interpreter ABI Platform
ytsaurus_python_client-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / ytsaurus_python_client-0.2.0.tar.gz

Download URL ytsaurus_python_client-0.2.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
185770a186bf111c960b461de0caaa03798af303782b0c8f52602dbcdbc5d744
BLAKE2b-256 checksum
How to use checksums
c7c615f0af17a7d4122ee28b1d4256abb5ea46c80663f64d05900c30ac8ed54a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / ytsaurus_python_client-0.2.0-py3-none-any.whl

Download URL ytsaurus_python_client-0.2.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a7ab6d0165ebf1e1fede010dfc133311e751edd99285fcf75a64b62c792d52f
BLAKE2b-256 checksum
How to use checksums
079ecd5f3bad27ff9279273a49982791338d8cca8dd65b0832f8d83c2863969b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

1 release file

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