--- id: pytd version: "2.4.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # pytd — Treasure Data Driver for Python License: permissive · Maintenance: active · Downloads: 352.0K/mo ## 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 above — 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 pip install pytd uv add pytd 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_current - Install friction: low - Maintenance: active - Downloads: 352.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags treasure data python client, presto query engine python, pandas dataframe to treasure data, bulk import data warehouse, sql query result to dataframe, data-warehouse, pandas-integration, sql-query [View on SkillFed](https://skillfed.io/packages/pytd) · [View on PyPI](https://pypi.org/project/pytd/)