Skip to main content

td-ts-compressor

Python helpers for the ts_compress_to Teradata Vantage table operator.

min_relative_gain and min_absolute_gain are accepted parameters but have no effect in the bundled C operator. The generated distance_rank_1 and distance_rank_2 features correspond to the first and last endpoints, whose distances are always 0 when present. Missing ranks are NULL (for example, distance_rank_2 for a one-point series).

This package is intentionally small: it bundles the ts_compress_to C table operator source and builds Teradata SQL for compression, feature engineering, installation, and TD_PLOT workflows. It does not include repository notebooks, generated images, local datasets, or project-level documentation.

Install

uv pip install td-ts-compressor

For local development from this repository:

uv pip install -e ".[dev]"

Install the optional Teradata interface when you want methods to return teradataml.DataFrame objects or execute SQL directly:

uv pip install -e ".[teradataml,dev]"

Install Agent Skills

The package bundles ts-comp-setup, ts-comp-compress, ts-comp-features, and ts-comp-plot to teach agents the package API and Teradata execution semantics. Install them into any agent's skill directory:

from td_ts_compressor import install_skills, list_skills, get_skill

list_skills()
install_skills()  # ~/.claude/skills, matching tdfs4ds
install_skills(".agents/skills")  # project Codex skills
install_skills("~/.codex/skills")  # user Codex skills
install_skills("/path/to/claude/skills")  # custom Claude destination
install_skills("/path/to/mistral/skills")  # custom Mistral destination
install_skills(".agents/skills", skills=["ts-comp-compress"], dry_run=True)

Each destination receives <skill-name>/SKILL.md. Use the directory configured for skill discovery in your agent; a custom destination does not configure the agent itself. Existing files are skipped unless overwrite=True. The returned list contains paths written (or planned with dry_run=True). get_skill(name) returns the bundled Markdown. export_skills(target_dir, ...) offers the same behavior with an explicit destination. These helpers need no Teradata connection or optional dependencies and are also available from td_ts_compressor.skills.

Compress A Series Table

from td_ts_compressor import (
    CompressorSpec,
    TeradataTimeSeriesCompressor,
    visual_fidelity,
)

compressor = TeradataTimeSeriesCompressor(
    CompressorSpec(
        id_columns=["mac_code"],
        time_column="seq_no",
        value_column="generator_speed",
        time_type="numeric",
    ),
    operator_database="utility_db",
)

compressed = compressor.compress(
    data_database="analytics",
    table_name="input_wind_plateau_full_csv",
    parameters=visual_fidelity(width_px=1024, height_px=768),
)

Pass as_dataframe=False to receive SQL instead of a teradataml.DataFrame. operator_database is where the table operator function mapping is installed. Source tables or views can live elsewhere and are addressed with data_database plus table_name. You can also pass input_query=... or dataframe=... for a SQL query or teradataml.DataFrame source.

Install The Table Operator

Generate installation SQL for a target database:

from td_ts_compressor import install_table_operator_sql

install_sql = install_table_operator_sql(target_database="utility_db")

Or execute the installation through teradataml.execute_sql:

from td_ts_compressor import install_table_operator

install_table_operator(target_database="utility_db")

Pass c_source_path=... only when you want to install a modified local C source file instead of the C source bundled with the package.

Build Features

from td_ts_compressor import analytical_points

features = compressor.features(
    data_database="analytics",
    table_name="input_wind_plateau_full_csv",
    parameters=analytical_points(auto_log_drop=1.5),
    top_k_distances=3,
)

Generated feature SQL includes point counts, compression ratio, reduction percentage, selected-distance aggregates, and optional distance ranks.

Enable TD_PLOT On Large Tables

Materialize a compressed plotting table first, then call TD_PLOT on that smaller table.

create_plot_table_sql = compressor.materialize_for_td_plot_sql(
    data_database="analytics",
    table_name="input_wind_plateau_full_csv",
    output_schema_name="analytics",
    output_table="plot_generator_speed_compressed",
)

plot_sql = compressor.td_plot_sql(
    schema_name="analytics",
    table_name="plot_generator_speed_compressed",
    title="Generator speed compressed",
)

Package Contents

Distributed artifacts include only:

  • td_ts_compressor Python modules
  • bundled ts_compress_to.c operator source
  • package-specific documentation
  • package tests in the source distribution
  • package metadata

They exclude notebooks, generated plots, local data, SQL scripts, and the broader repository documentation.

Publishing

Publishing is configured through GitHub Actions and PyPI Trusted Publishing. See package_docs/publishing.md in the source distribution for the release process.

Metadata

Release files for td-ts-compressor 0.1.12

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

Built distribution (wheel)

Table of built distributions (wheels) for td-ts-compressor 0.1.12
File Interpreter ABI Platform Actions
td_ts_compressor-0.1.12-py3-none-any.whl Python 3 none any Details for td_ts_compressor-0.1.12-py3-none-any.whl

Release files / td_ts_compressor-0.1.12-py3-none-any.whl

Download URL td_ts_compressor-0.1.12-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2faf54f7cadc72f4b1feda5e01276283135969282949a23632e25e2377698ac8
BLAKE2b-256 checksum
How to use checksums
b2632b52ed3bb6877a59587b767fbe33bde326569e96fe96a295c2bfd20987a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for td-ts-compressor 0.1.12

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