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!
pip install datapush
# 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'
)
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
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
)
Currently, we don't support spartial data type (geometry, point, polygon etc...)