Skip to main content

Python parser for legacy Tableau Data Extract (TDE) files

Project description

pytde

A Python parser for legacy Tableau Data Extract (TDE) files.

Overview

pytde reads TDE files (the legacy Tableau data format used before Hyper) and converts them to pandas DataFrames. This is useful for accessing data from older Tableau extracts without needing Tableau Desktop or Server.

Installation

pip install pytde

Or install from source:

git clone https://github.com/ronreiter/pytde.git
cd pytde
pip install -e .

Quick Start

from pytde import read_tde

# Read a TDE file
tables = read_tde('data.tde')

# Get the Extract table as a DataFrame
df = tables['Extract']

# Work with the data
print(df.head())
print(df.describe())

API Reference

read_tde(file_path: str) -> dict[str, pd.DataFrame]

Read a TDE file and return its contents as pandas DataFrames.

from pytde import read_tde

tables = read_tde('sales_data.tde')
df = tables['Extract']

read_tde_metadata(file_path: str) -> dict

Read TDE file metadata without fully parsing the data.

from pytde import read_tde_metadata

metadata = read_tde_metadata('sales_data.tde')
print(metadata['columns'])       # List of column names
print(metadata['column_types'])  # Column data types
print(metadata['file_size'])     # File size in bytes
print(metadata['format_version']) # TDE format version

TDEParser class

For more control over parsing, use the TDEParser class directly:

from pytde import TDEParser

parser = TDEParser('data.tde')
tables = parser.parse()
metadata = parser.get_metadata()

# Access internal state
print(parser.xml_metadata)  # Embedded XML schema
print(parser.column_entries)  # Column index entries

Command Line Interface

pytde includes a CLI tool for quick inspection of TDE files:

pytde data.tde

Output:

Parsing TDE file: data.tde
------------------------------------------------------------
Format version: 2
File size: 51306 bytes
Columns found: ['Region', 'Sales', 'Sales Person']
Column types: {'Region': 'string', 'Sales': 'double', 'Sales Person': 'string'}

============================================================
Table: Extract
Shape: (43, 3)
Columns: ['Region', 'Sales', 'Sales Person']
...

Supported Data Types

TDE Type Python/Pandas Type
string object (str)
double float64
integer int64
date object*
datetime object*
boolean bool

*Date/datetime support is limited in the current version.

TDE File Format

TDE files are binary files that store columnar data optimized for Tableau's data engine. Key features:

  • Little-endian byte ordering
  • Block-based structure with markers (f0ca1278 for data, f1ca1278 for index)
  • Dictionary encoding for string columns
  • Embedded XML metadata for schema definitions

For detailed format specification, see TDE.MD.

Limitations

  • Index decoding: String column row-to-value mapping uses fallback distribution when exact indices cannot be decoded
  • Date/time columns: Limited support for date and datetime types
  • Compression: Some compressed TDE files may not be fully supported
  • Large files: Memory usage scales with file size (entire file is loaded into memory)

Development

Setup

git clone https://github.com/ronreiter/pytde.git
cd pytde
pip install -e ".[dev]"

Running Tests

pytest

Running Tests with Coverage

pytest --cov=pytde --cov-report=html

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

This parser was developed through reverse engineering of the TDE file format. Special thanks to the open source community for their work on understanding proprietary file formats.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytde-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytde-0.1.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pytde-0.1.2.tar.gz.

File metadata

  • Download URL: pytde-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for pytde-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cffd99934939c6687b5abe941d6b435596129e2860a170d76df0bcbb4bdc1745
MD5 52dae1bba3e470846077d42d95303e0d
BLAKE2b-256 8dc573cd8d27cca40a6912f122086a415b690777135345ca2a2f5569060165f3

See more details on using hashes here.

File details

Details for the file pytde-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pytde-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for pytde-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce23851bea13b48fe930d76758fe707b89370653c2ce333a30728eeec26713ae
MD5 a4d0aa8b3cc6468d419f3dc96f999287
BLAKE2b-256 409d18b4281159a8627425145e8ebcf0d005edba8410cfd64333339d3697aabe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page