skillfed

pytd

Treasure Data Driver for Python

pytd v2.4.0 352.0K downloads/30d#7,316 on PyPI20
Permissive license Apache-2.0 Active released

What it is and what it does

pytd is a Python driver for Treasure Data that bridges pandas DataFrames with Treasure Data's query engines and storage. It wraps the REST API, Presto query engine, and Plazma primary storage into a single client interface, letting you issue SQL queries and retrieve results as structured data, or write DataFrames back to Treasure Data using bulk import or INSERT INTO methods.

The package is designed for analytical workflows in Jupyter notebooks and Python applications where you need to move data between pandas and Treasure Data efficiently. It supports both Presto and Hive query engines, offers generator-based iterative result retrieval via DB-API to handle timeouts on large result sets, and provides multiple data ingestion strategies—bulk import for scalability, INSERT INTO for memory efficiency on smaller datasets, or Spark for high-performance writes to Plazma storage (requires special account activation).

Use it for:

  • Run Presto or Hive SQL queries against Treasure Data and retrieve results as Python dicts or via DB-API cursors
  • Write pandas DataFrames to Treasure Data tables using bulk import, INSERT INTO, or Spark writer
  • Migrate from the deprecated pandas-td package while maintaining compatible function signatures
  • Perform iterative data retrieval in Jupyter notebooks to avoid Presto timeout errors on large result sets
  • Access Treasure Data's Plazma primary storage directly via PySpark for high-volume analytical workloads

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pytd provides Python interfaces to Treasure Data's REST APIs, Presto query engine, and Plazma storage, enabling efficient read/write operations on large data volumes through pandas DataFrames.

Yes. pytd is actively maintained, has no known vulnerabilities, uses a permissive license, and offers low install friction. It is the recommended Python client for analytical workflows and efficient data movement with Treasure Data. Install it if you need to query Treasure Data or write pandas DataFrames to it; use td-client-python instead if you only need basic REST API operations.

Install

pytd on PyPI

pip

pip install pytd

uv

uv add pytd

poetry

poetry add pytd

Installing pytd

Before you install

Low install friction with a pure-wheel distribution. Active maintenance with recent commits and stable production status. Requires Python 3.10 or later and pandas 2.1 or later.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions.

Quickstart

pip install pytd

import pytd
client = pytd.Client(database='sample_datasets')
result = client.query('select symbol, count(1) as cnt from nasdaq group by 1')

Requires TD_API_KEY and TD_API_SERVER environment variables, or explicit apikey and endpoint parameters. Python 3.10+ and pandas 2.1+ required.

Verify before relying

  • Whether Presto or Hive query performance characteristics are documented for typical data volumes
  • Current status and migration path for deprecated spark writer option
  • Whether DB-API cursor.description field is reliably populated across all query types

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 8 — urllib3, trino, pandas, numpy, td-client, pytz, tqdm, pyarrow
Maintenance actively maintained — 192 days since the last release
Last repo commit
First released
Downloads 352,031/month — #7,316 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytd-2.4.0-py3-none-any.whl

Keywords: database, treasure-data

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Database

Tags

treasure data python clientpresto query engine pythonpandas dataframe to treasure databulk import data warehousesql query result to dataframe
data-warehousepandas-integrationsql-query

More Database packages