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, TableSchema
from tablefiller.types import Int, Str, Date

schema = TableSchema(columns={
    "id": Int(5, 10),
    "name": Str(10),
    "created_at": Date("01.01.2022", "31.12.2023", '%d.%m.%Y')
}, local="en_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.3.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.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tablefiller-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9c917f8e1f28acb70ca2b78d108c3e1d54d6d7bd680c7b16aed2394add706694
MD5 c2362059f65bf09fb3d6e925978e25cb
BLAKE2b-256 be8bc13738aab6cb268dc03361fc203a014f2797490c4baa450a253b009c99bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablefiller-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: tablefiller-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3c4e915116df8a4a0ab1b955aa0881d745c8267552b2f4a1534aad3a1fa208ad
MD5 ec00c98fb1f3d4d63ba3198fbc22d20b
BLAKE2b-256 5f487d9b82f283f0eca5f085a0d887c0d354d1ab1c288ad1351842cc50198cf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tablefiller-0.1.3-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