Skip to main content

A data profiling tool for delimited and database sources.

Project description

Splurge Data Profiler

A powerful data profiling tool for delimited and database sources that automatically infers data types and creates optimized data lakes (SQLite database).

Features

  • DSV File Support: Profile CSV, TSV, and other delimiter-separated value files
  • Automatic Type Inference: Intelligently detect data types using adaptive sampling
  • Data Lake Creation: Generate SQLite databases with optimized schemas
  • Inferred Tables: Create tables with both original and type-cast columns
  • Flexible Configuration: JSON-based configuration for customization
  • Command Line Interface: Easy-to-use CLI for batch processing

Installation

pip install splurge-data-profiler

Quick Start

  1. Create a configuration file:
python -m splurge_data_profiler create-config examples/example_config.json
  1. Profile your data:
python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json

CLI Usage

Profile Command

Profile a DSV file and create a data lake:

python -m splurge_data_profiler profile <dsv_file> <config_file> [options]

Options:

  • --verbose: Enable verbose output

Examples:

# Basic profiling
python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json

# Verbose output
python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json --verbose

Create Config Command

Generate a sample configuration file:

python -m splurge_data_profiler create-config <output_file>

Example:

python -m splurge_data_profiler create-config examples/example_config.json

Configuration File

The configuration file is a JSON file that specifies how to process your DSV file:

{
  "data_lake_path": "./data_lake",
  "dsv": {
    "delimiter": ",",
    "strip": true,
    "bookend": "\"",
    "bookend_strip": true,
    "encoding": "utf-8",
    "skip_header_rows": 0,
    "skip_footer_rows": 0,
    "header_rows": 1,
    "skip_empty_rows": true
  }
}

Configuration Options

Required Fields

  • data_lake_path: Directory where the SQLite database will be created

DSV Configuration (dsv object)

  • delimiter: Character used to separate values (default: ",")
  • strip: Whether to strip whitespace from values (default: true)
  • bookend: Character used to quote values (default: "\"")
  • bookend_strip: Whether to strip bookend characters (default: true)
  • encoding: File encoding (default: "utf-8")
  • skip_header_rows: Number of header rows to skip (default: 0)
  • skip_footer_rows: Number of footer rows to skip (default: 0)
  • header_rows: Number of header rows (default: 1)
  • skip_empty_rows: Whether to skip empty rows (default: true)

Note: The profiler always uses adaptive sampling and always creates an inferred table.

Examples

Example 1: Basic Profiling

  1. Create a configuration:
python -m splurge_data_profiler create-config examples/example_config.json
  1. Profile your data:
python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json

Output:

=== PROFILING RESULTS ===
id: INTEGER
name: TEXT
age: INTEGER
salary: FLOAT
is_active: BOOLEAN
hire_date: DATE
last_login: DATETIME

Profiling completed successfully!

Note: Datetime values should be in ISO 8601 format (YYYY-MM-DDTHH:MM:SS) for proper type inference.

Example 2: With Inferred Table

python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json

This creates an additional table with:

  • Original columns (preserving text values)
  • Cast columns with inferred data types

Example 3: Verbose Output

python -m splurge_data_profiler profile examples/example_data.csv examples/example_config.json --verbose

Data Types

The profiler can infer the following data types:

  • TEXT: String values
  • INTEGER: Whole numbers
  • FLOAT: Decimal numbers
  • BOOLEAN: True/false values
  • DATE: Date values (YYYY-MM-DD)
  • TIME: Time values (HH:MM:SS)
  • DATETIME: Date and time values (ISO 8601 format: YYYY-MM-DDTHH:MM:SS)

Adaptive Sampling

When no sample size is specified, the profiler uses adaptive sampling:

  • Datasets < 25K rows: 100% sample
  • Datasets 25K-50K rows: 50% sample
  • Datasets 50K-100K rows: 25% sample
  • Datasets 100K-500K rows: 20% sample
  • Datasets > 500K rows: 10% sample

Programmatic Usage

You can also use the profiler programmatically:

from splurge_data_profiler.data_lake import DataLakeFactory
from splurge_data_profiler.profiler import Profiler
from splurge_data_profiler.source import DsvSource

# Create DSV source
dsv_source = DsvSource(
    file_path="examples/example_data.csv",
    delimiter=",",
    encoding="utf-8"
)

# Create data lake
data_lake = DataLakeFactory.from_dsv_source(
    dsv_source=dsv_source,
    data_lake_path="./data_lake"
)

# Create profiler and run profiling
profiler = Profiler(data_lake=data_lake)
profiler.profile()

# Get results
for column in profiler.profiled_columns:
    print(f"{column.name}: {column.inferred_type}")

Requirements

  • Python 3.10+
  • SQLAlchemy >= 2.0.37
  • splurge-tools == 0.2.4

License

MIT License

Changelog

[0.1.1] 2025-07-10

  • Refactored adaptive sampling logic: Sampling thresholds and factors are now defined as class-level rules using a dataclass, improving maintainability and clarity.
  • Public classmethod for adaptive sample size: calculate_adaptive_sample_size is now a public classmethod, replacing the previous private method and magic numbers.
  • Test suite updated: All tests now use the new classmethod for adaptive sample size, ensuring consistency and eliminating magic numbers.
  • Sampling rules updated: New adaptive sampling rules:
    • < 5K rows: 100%
    • < 10K rows: 80%
    • < 25K rows: 60%
    • < 100K rows: 40%
    • < 500K rows: 20%
    • = 500K rows: 10%

  • General code quality improvements: Improved type annotations, error handling, and code organization per project standards.
  • Enhanced test coverage and reliability: Test logic and assertions now reflect the updated adaptive sampling strategy.
  • (See previous notes for performance test and runner improvements.)

[0.1.0] 2025-07-06

  • Initial release of Splurge Data Profiler
  • CLI implementation with profile and create-config commands
  • DSV file support for CSV, TSV, and other delimiter-separated value files
  • Automatic type inference using adaptive sampling strategy
  • Data lake creation with SQLite database generation
  • Inferred table creation with both original and type-cast columns
  • JSON configuration for DSV parsing options
  • ISO 8601 datetime support for proper type inference
  • Adaptive sampling based on dataset size (100% for <25K rows, 50% for 25K-50K, 25% for 50K-100K, 20% for 100K-500K, 10% for >500K)
  • Simplified workflow - always profiles and always creates inferred tables

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

splurge_data_profiler-0.1.1.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

splurge_data_profiler-0.1.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file splurge_data_profiler-0.1.1.tar.gz.

File metadata

  • Download URL: splurge_data_profiler-0.1.1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for splurge_data_profiler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0076cf144ba6ebc16ce2e794e0150330eee988fe10dddb808319d9dee30f67b9
MD5 61e5d23627c0d639fbb6d23c9bc9f9ab
BLAKE2b-256 810e9f75bc5027033439e48a06d293e0f08b92fd19de7706b29be5173f72254a

See more details on using hashes here.

File details

Details for the file splurge_data_profiler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for splurge_data_profiler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 755dd95bfdb3a98bb9a58fe0de6577d6203c20ea465e147b2aab9710f57ab29a
MD5 5463d3b90ad72cedb680b1784d40ff26
BLAKE2b-256 80304554b9f18c1e40afd9e09cdfbcc4a9c59f297ea7ff931590926f75d97241

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