Skip to main content

DataWarp is a powerful Python library that simplifies working with data files across various formats and storage locations and orchestrate data workflow for multiple backends or services.

Project description

codecov

Data-Warp

Data-Warp is a powerful Python library that simplifies working with data files across various formats and storage locations. At its core is the FileConnector module, a universal connector designed to streamline data ingestion from multiple sources with minimal configuration.

Key Features

  • Multiple File Formats: Native support for CSV, JSON, Parquet, Excel, and extensible to other formats
  • Diverse Data Sources: Connect to files from local storage, HTTP endpoints, AWS S3, and more
  • Flexible Reading Engines: Choose between pandas, Python built-ins, or PyArrow for optimal performance
  • Efficient Data Handling: - Streaming capability for memory-efficient processing of large files - Batch processing to handle data in manageable chunks - Parallel data fetching for improved performance
  • Error Handling: Built-in retry mechanisms and comprehensive error reporting
  • User-Friendly API: Simple, consistent interface regardless of underlying data source or format

Use Cases

  • Data engineering pipelines requiring connection to various data sources
  • ETL processes working with multiple file formats
  • Data science workflows needing efficient data loading
  • Applications requiring streaming capabilities for large datasets
  • Cross-platform data access with consistent API

Example

# Connect to a local CSV file
connector = FileConnector(file_path="data.csv", source="local")
data = connector.fetch()

# Stream a large JSON file from S3
s3_connector = FileConnector(
    file_path="s3://bucket/large_data.json",
    file_type="json",
    source="s3",
    streaming=True
)
for chunk in s3_connector.stream(chunk_size=10000):
    process_data(chunk)

# Fetch multiple files in parallel
connector = FileConnector(file_path="data.parquet", source="local")
results = connector.fetch_parallel(["file1.parquet", "file2.parquet", "file3.parquet"]) 

# Fetch files in batch with builtin support with additional supportive methods,

# fetch_batch #built-in file format
FileConnector("huge_csv_file.csv", reader="builtin").fetch_batch()


# For json has various additional methods to deal with large files and useful for ad-hoc filter

#search
list(FileConnector(huge_json_file.json, reader="builtin").fetch_batch().search(lambda rec: rec.get("hash_id")=="6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b"))

#filter
filtered = FileConnector(huge_json_file.json, reader="builtin").fetch_batch().filter_batches(lambda rec: rec[0].get("int_field") < 8516)
print("filtered", filtered.next())

# Map batches:
mapped =  FileConnector(huge_json_file.json, reader="builtin").fetch_batch().map_batches(
    lambda batch: [rec for rec in batch if rec.get("date") < "2002-07-06"]
)
for batch in mapped:
    print("Mapped batch:", batch)

FileConnector(huge_json_file.json, reader="builtin").fetch_batch().to_dataframe().head()
     

Installation

Basic Installation

pip install data-warp

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

data_warp-0.1.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

data_warp-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: data_warp-0.1.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for data_warp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 569501c5bf03c435cafc81803efb68ada39f10d0df1dd6d949b7873d4ed71207
MD5 74fb6b0ba482cb925190906a5b622fae
BLAKE2b-256 244ce9fd9658e01a051eaaa622a59bb9e311b1916a6a3154ba45ea943705d70a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: data_warp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for data_warp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2936279b2bfd75a31f188df9ef88a77db1ba888bc669a786372c6d3e6c1ac38
MD5 126c00a69e8e7c8983eb6686ec17d29c
BLAKE2b-256 81446ab8715351aecd2cefa7e7092644135f05fe3872a87c46c9e5e7a5ea6f41

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