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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bc4bb90a0416d5117db59e5c39d9a22f5f551608aebf88e7202f14d2574e7dc
|
|
| MD5 |
336a25c9abc811de9e0046cfa9e3c17e
|
|
| BLAKE2b-256 |
c0f58cba95b5e636a1ac4250bd5ba47f9b8d95f3c1760d6f2728476f6d5e4484
|
Provenance
The following attestation bundles were made for tablefiller-0.1.5.tar.gz:
Publisher:
workflow.yml on Supercili0usMe/table-filler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tablefiller-0.1.5.tar.gz -
Subject digest:
6bc4bb90a0416d5117db59e5c39d9a22f5f551608aebf88e7202f14d2574e7dc - Sigstore transparency entry: 172198318
- Sigstore integration time:
-
Permalink:
Supercili0usMe/table-filler@64c8ab2b3ee09cfa231d773e93b6b35cc6d759cf -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/Supercili0usMe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@64c8ab2b3ee09cfa231d773e93b6b35cc6d759cf -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
394103a6123c6e0d853968e1f3ad66cb5f495f9fc0432b6aa4e2f8b1eaab2cd6
|
|
| MD5 |
71063b94438f8b0da50d56930b6a5395
|
|
| BLAKE2b-256 |
02537f34849990aa63adf23f9323dc602c20ce68360319d3fdc34e6b5c0bcc40
|
Provenance
The following attestation bundles were made for tablefiller-0.1.5-py3-none-any.whl:
Publisher:
workflow.yml on Supercili0usMe/table-filler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tablefiller-0.1.5-py3-none-any.whl -
Subject digest:
394103a6123c6e0d853968e1f3ad66cb5f495f9fc0432b6aa4e2f8b1eaab2cd6 - Sigstore transparency entry: 172198319
- Sigstore integration time:
-
Permalink:
Supercili0usMe/table-filler@64c8ab2b3ee09cfa231d773e93b6b35cc6d759cf -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/Supercili0usMe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@64c8ab2b3ee09cfa231d773e93b6b35cc6d759cf -
Trigger Event:
push
-
Statement type: