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.3.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.3.0
File Size Uploaded
ytsaurus_python_client-0.3.0.tar.gz 16.5 kB Details

Built distribution (wheel)

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

Total release size: 31.3 kB

Release files / ytsaurus_python_client-0.3.0.tar.gz

Download URL ytsaurus_python_client-0.3.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
214830b9f0623ffdc56486607d6e78a7b9d38323d5c84f1a4c62e113af7c44bb
BLAKE2b-256 checksum
How to use checksums
cc67d4a0458a116a54f324d0f9358fd2b07cd89ce83a307c1b7930cff9a5b2af
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.3.0-py3-none-any.whl

Download URL ytsaurus_python_client-0.3.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46fde20db3535841bea67b2fabdb468e61ebe9acc304f5ffac3b031f14488a1e
BLAKE2b-256 checksum
How to use checksums
551b87801698d3b7114b1d38ab2e4b6ef9c8b9a5ddb5b10d8263b692829e09e2
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

This release

0.3.0 This release

2 release files

0.2.0

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