fake2db 0,0,0,0,0,0,4,0 python

create custom test databases that are populated with fake data

2 years after GPL-2.0

Screenshot


Latest Version Status

About

Generate fake but valid data filled databases for test purposes using most popular patterns(AFAIK). Current support is sqlite, mysql, postgresql, mongodb, redis, couchdb.

Installation

The installation through pypi retrieves 'fake-factory' as a main dependency.

pip install fake2db

Optional requirements
PostgreSQL
pip install psycopg2

For psycopg2 to install you need pg_config in your system.

On Mac, the solution is to install postgresql:

brew install postgresql

On CentOS, the solution is to install postgresql-devel:

sudo yum install postgresql-devel

Mongodb
pip install pymongo
Redis
pip install redis
MySQL

mysql connector is needed for mysql db generation:

http://dev.mysql.com/downloads/connector/python/

CouchDB
pip install couchdb
Usage

--rows argument is pretty clear :) integer

--db argument takes 6 possible options : sqlite, mysql, postgresql, mongodb, redis, couchdb

--name argument is OPTIONAL. When it is absent fake2db will name db's randomly.

--host argument is OPTIONAL. Hostname to use for database connection. Not used for sqlite.

--port argument is OPTIONAL. Port to use for database connection. Not used for sqlite.

--username argument is OPTIONAL. Username for the database user.

--password argument is OPTIONAL. Password for database user. Only supported for mysql & postgresql.

--locale argument is OPTIONAL. The localization of data to be generated ('en_US' as default).

--seed argument is OPTIONAL. Integer for seeding random generator to produce the same data set between runs. Note: uuid4 values still generated randomly.

fake2db --rows 200 --db sqlite
fake2db --rows 1500 --db postgresql --name test_database_postgre
fake2db --db postgresql --rows 2500 --host container.local --password password --user docker
fake2db --rows 200 --db sqlite --locale cs_CZ --seed 1337

In addition to the databases supported in the db argument, you can also run fake2db with FoundationDB SQL Layer. Once SQL Layer is installed, simply use the postgresql generator and specify the SQL Layer port. For example:

fake2db --rows --db postgresql --port 15432

Custom Database Generation

If you want to create a custom db/table, you have to provide --custom parameter followed by the column item you want. At the point in time, i mapped all the possible column items you can use here:

https://github.com/emirozer/fake2db/blob/master/fake2db/custom.py

Feed any keys you want to the custom flag:

fake2db.py --rows 250 --db mysql --username mysql --password somepassword --custom name date country
fake2db.py --rows 1500 --db mysql --password randompassword --custom currency_code credit_card_full credit_card_provider
fake2db.py --rows 20 --db mongodb --custom name date country


Sample output - sqlite

Screenshot
Screenshot
Screenshot


Related Repositories

awesome-python-cn

awesome-python-cn

Python资源大全中文版,包括:Web框架、网络爬虫、模板引擎、数据库、数据可视化、图片处理等,由伯乐在线持续更新。 ...

awesome-python

awesome-python

A curated list of awesome Python frameworks, libraries and software ...

awesome-python

awesome-python

A curated list of awesome Python frameworks, libraries and software ...

awesome-python-cn

awesome-python-cn

Python资源大全中文版,内容包括:Web框架、网络爬虫、网络内容提取、模板引擎、数据库、数据可视化、图片处理、文本处理、自然语言处理、机器学习、日志、代码分 ...

awesome-python

awesome-python

A curated list of awesome Python frameworks, libraries, software and resources ...


Top Contributors

emirozer jrullmann karlwithak mauricioabreu Xuefeng-Zhu alexandershov shelt vargi thomasdziedzic akash0x53 squarejaw rgfoley

Releases

-   0.5.0 zip tar