Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wklee610/datapush

MySQL Data Generator
https://github.com/wklee610/datapush

automatic data data-generator database dataset db dynamically generator mysql test testing-tools

Last synced: about 2 months ago
JSON representation

MySQL Data Generator

Awesome Lists containing this project

README

        

# Datapush

Datapush is a Python package that generate data to MySQL Database dynamically.

When you need data for MySQL for some reasons (for test), and too lazy to make mock data, here is the answer.

***Just enter your table, datapush will check each column and automatically generate the appropriate data!***

## Download

```bash
pip install datapush
```

## Usage
```python
# Connect to db
conn = datapush.mysql.connect(
host='localhost',
port=3306,
user='root',
password='',
database=''
)

# Make generator with connection
generator = datapush.Generator(conn)

# Generate!
generator.generate(
table='example_table'
)
```

## Option
In generator.generate(), there has several options.

Args:
- table (str): The name of the table.
- count (int): The number of data you want to generate. (default: 10)
- **option (dict): Some specific data for each column
you want to generate (uuid, username, ip, etc...)
ex) user=id, uuid=uuid, ip_address=ip,
ex) column_name=type

## Extra Usage
```python
generator.generate(
table='example_table',
count=1000,
char_col='ip', # column_name is char_col and make unique ip
text_col='id', # column_name is text_col and make unique id
varchar_col='uuid' # column_name is varchar_col and make unique uuid
)
```

## Note
Currently, we don't support spartial data type (geometry, point, polygon etc...)