| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
11年前发布

创建测试数据库并用假数据填充:fake2db

fake2db可用于创建测试数据库并用假数据填充。
使用最流行的模式(AFAIK)来生成假的,但有效的数据填充数据库,用于测试目的。目前支持的SQLite,MySQL和PostgreSQL,MongoDB。

Installation

The installation through pypi also retrieves 'requirements'. Which are : fake-factory, pymongo, psycopg2

pip install fake2db

non-PYPI included REQUIREMENT

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

Optional - if you are going to use mysql

mysql connector is needed for mysql db generation:

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

Usage

It is as follows, at this point in time, fake2db accepts rows and db argument.--rows argument is pretty clear...--db argument takes 4 possible options : sqlite, mysql, postgresql, mongodb--name argument is OPTIONAL. When it is absent fake2db will name db's randomly.

fake2db --rows 200 --db sqlite
fake2db --rows 1500 --db postgresql --name test_database_postgre

 

Sample output - sqlite创建测试数据库并用假数据填充:fake2db

项目主页:http://www.open-open.com/lib/view/home/1418964982886

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1418964982886.html
fake2db 测试工具