Skip to main content

Library for generate random data for SQL tables

Project description

Table-Filler 🏗️

Table-Filler is a library for generating test data for SQL tables, JSON, and CSV.

Installation 📦

pip install tablefiller

Or install the latest version from GitHub:

pip install git+https://github.com/Supercili0usMe/table-filler.git

Quick Start 🚀

from tablefiller import DataGenerator, Table
from tablefiller.types import Int, Str, Date

schema = Table(columns={
    "id": Int(5, 10),
    "name": Str(10),
    "created_at": Date("01.01.2022", "31.12.2023", '%d.%m.%Y')
}, local="en")

generator = DataGenerator(schema)
data = generator.generate_data(5)

print(data.to_pandas())  # Output to DataFrame
data.to_csv("output.csv")  # Save to CSV

Features 🎯

✔️ Generate numbers, strings, dates, and categories
✔️ Faker support (names, addresses, emails)
✔️ Export to CSV, JSON, SQL
✔️ pandas.DataFrame support
✔️ Сustom data types

Available Data Types 🏗️

Type Description
Int(a, b) Integer from a to b
Float(a, b, d) Number with d decimal places
Str(n) String of length n
Date(start, end) Random date within range
Category([...]) Category from a list
Job("type") Faker data (male, female, both)
Phone() Faker data
Email("type") Faker data (email, free, company)
Name("type") Faker data (male, female, both)
Address("type") Faker data (street, city, full)

Data Export 📤

data.to_csv("output.csv")  # CSV
data.to_json("output.json")  # JSON
data.to_sql("output.sql")  # SQL

Creating Custom Data Types 🔧

import random
from table_filler.types import DataType

class HexColor(DataType):
    def generate(self):
        return f"#{random.randint(0, 0xFFFFFF):06x}"

schema = TableSchema(columns={"id": Int(3), "color": HexColor()})

Testing ✅

pytest tests/

License 📜

MIT License

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

tablefiller-0.1.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

tablefiller-0.1.5-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tablefiller-0.1.5.tar.gz.

File metadata

  • Download URL: tablefiller-0.1.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tablefiller-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6bc4bb90a0416d5117db59e5c39d9a22f5f551608aebf88e7202f14d2574e7dc
MD5 336a25c9abc811de9e0046cfa9e3c17e
BLAKE2b-256 c0f58cba95b5e636a1ac4250bd5ba47f9b8d95f3c1760d6f2728476f6d5e4484

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablefiller-0.1.5.tar.gz:

Publisher: workflow.yml on Supercili0usMe/table-filler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tablefiller-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: tablefiller-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tablefiller-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 394103a6123c6e0d853968e1f3ad66cb5f495f9fc0432b6aa4e2f8b1eaab2cd6
MD5 71063b94438f8b0da50d56930b6a5395
BLAKE2b-256 02537f34849990aa63adf23f9323dc602c20ce68360319d3fdc34e6b5c0bcc40

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablefiller-0.1.5-py3-none-any.whl:

Publisher: workflow.yml on Supercili0usMe/table-filler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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