創建測試數據庫并用假數據填充:fake2db

jopen 11年前發布 | 30K 次閱讀 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.baiduhome.net/lib/view/home/1418964982886

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!