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.0.tar.gz (13.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.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytde-0.1.0.tar.gz
  • Upload date:
  • Size: 13.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.0.tar.gz
Algorithm Hash digest
SHA256 82e75ec6e2980de124871735e99a3e0130781137cf26e3e654aa0bfa1256517a
MD5 0e38d9cc96dad2d0c3ebc3b25f066c05
BLAKE2b-256 d08e35981a3fe86e521525d0cbb4d006e8dcf833a2488f1bb5035e7dd1151aec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytde-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 acc9cae5169e6db76448543a90f0d7b6377574d083b65f2c083768a6a07bed6a
MD5 14d75352b10d4bbb498c71b22b92ec3b
BLAKE2b-256 aeb67f3d3ed907c82fdb0c9e74092ebb0190d2e2271c4d02f2e9c63b801919c9

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