Graph
TSV

🗂️TSV

NEW

Also known as: Tab Separated Values, Tab-Delimited

TSV is a plain text tabular format where fields are separated by tab characters and records are separated by newlines.

DESCRIPTION

Tab-Separated Values (TSV) store tabular data using tabs as field delimiters. TSV simplifies parsing by avoiding delimiter conflicts common with commas, but embedded tabs require careful handling. It is popular for data exchange, logs, and spreadsheet exports. While lacking a universal formal standard, conventions exist for quoting, escaping, and character encoding. TSV’s simplicity suits pipelines and quick inspection, though typed formats like Parquet may be preferable for analytics at scale.

ALTERNATIVE DEFINITIONS

Wikipedia

Tab-separated values (TSV) is a simple text format for storing data in a tabular structure, e.g., database table or spreadsheet data, and a way of exchanging information between databases.

Notes simplicity and usage for tabular data exchange.

Source

IANA

The text/tab-separated-values media type identifies files that contain records with fields separated by TAB characters.

Provides the registered media type for TSV files.

Source

Delimiter Encoding Escaping Data Schema Flat File MIME Type Data Ingestion RFC 4180

COMPETING TERMS

CSV JSON Lines

KNOWLEDGE AREAS

Data Engineering Data Integration & Interoperability Platform & Tooling

TARGET AUDIENCE

Data Engineer Analytics Engineer Data Analyst BI Specialist

EXTERNAL SOURCES

TOP QUESTIONS

When should I choose TSV over CSV?

TSV reduces delimiter conflicts when data contains commas. It’s convenient for quick exports and logs, though embedded tabs still require care.

Category: Opinion

What are common pitfalls with TSV?

Inconsistent quoting, mixed encodings, and tabs in free text fields break parsers. Define and enforce a clear schema and escaping rules.

Category: Mistakes

How should TSV handle text qualifiers?

TSV often omits quotes. If text qualifiers are used, document escaping rules for embedded tabs and newlines to ensure interoperability.

Category: Requirements

Is there a formal standard for TSV?

No universally adopted standard exists, though IANA registers a media type. Teams should agree on conventions for quoting and encoding.

Category: Misunderstanding

How does TSV compare to Parquet?

TSV is human-readable but lacks types and compression. Parquet is columnar, typed, and compressed, ideal for analytics at scale.

Category: Alternatives

What encoding should I use for TSV?

Prefer UTF-8 with explicit documentation. Be cautious with legacy encodings and ensure consistent line endings across platforms.

Category: Best practices

How do I validate TSV files?

Use schema checks, row-length validation, and sampling for embedded tabs. Tools like Frictionless validate tabular data packages.

Category: Testing

How to stream large TSV files efficiently?

Process line-by-line with buffered I/O, chunking, and parallelization when possible. Avoid loading entire files into memory.

Category: Requirements

What MIME type should servers return for TSV?

Use text/tab-separated-values with charset parameter, typically UTF-8, to indicate TSV content appropriately.

Category: Example