https://github.com/supercili0usme/table-filler
Table-Filler: A simple Python library for generating test data for SQL, JSON, and CSV. Supports Faker and custom data types.
https://github.com/supercili0usme/table-filler
csv data-generation faker json python sql table-generator
Last synced: 5 months ago
JSON representation
Table-Filler: A simple Python library for generating test data for SQL, JSON, and CSV. Supports Faker and custom data types.
- Host: GitHub
- URL: https://github.com/supercili0usme/table-filler
- Owner: Supercili0usMe
- License: mit
- Created: 2025-02-06T16:36:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-18T17:10:38.000Z (over 1 year ago)
- Last Synced: 2025-04-08T04:17:18.536Z (over 1 year ago)
- Topics: csv, data-generation, faker, json, python, sql, table-generator
- Language: Python
- Homepage: https://pypi.org/project/tablefiller/
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Table-Filler ποΈ
**Table-Filler** is a library for generating test data for SQL tables, JSON, and CSV.
## Installation π¦
```sh
pip install tablefiller
```
Or install the latest version from GitHub:
```sh
pip install git+https://github.com/Supercili0usMe/table-filler.git
```
## Quick Start π
```python
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 π€
```python
data.to_csv("output.csv") # CSV
data.to_json("output.json") # JSON
data.to_sql("output.sql") # SQL
```
## Creating Custom Data Types π§
```python
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 β
```sh
pytest tests/
```
## License π
**MIT License**