Skip to content

Commit

Permalink
Merge pull request #41 from trinaldi/master
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
emirozer authored Jan 31, 2018
2 parents 4f6686f + f676b12 commit a05bddb
Showing 1 changed file with 44 additions and 39 deletions.
83 changes: 44 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,58 @@



##### About
## 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*. <br>

##### Installation
## Installation

The installation through pypi retrieves 'fake-factory' as a main dependency.
> pip install fake2db
<br>

###### Optional requirements
pip install fake2db


## Optional requirements


###### PostgreSQL

pip install psycopg2

For psycopg2 to install you need *pg_config* in your system.
For `psycopg2` to install you need `pg_config` in your system.

On **Mac**, the solution is to install `postgresql`:

brew install postgresql

On Mac, the solution is to install *postgresql*:
> brew install postgresql
On **CentOS**, the solution is to install `postgresql-devel`:

On CentOS, the solution is to install *postgresql-devel*:
> sudo yum install postgresql-devel
<br>
sudo yum install postgresql-devel

###### Mongodb

#### Mongodb

pip install pymongo

###### Redis
#### Redis

pip install redis

###### MySQL
#### MySQL

mysql connector is needed for mysql db generation:
> http://dev.mysql.com/downloads/connector/python/
<br>

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

##### CouchDB
### CouchDB

pip install couchdb
pip install couchdb

##### Usage
***

## Usage

*--rows* argument is pretty clear :) integer

Expand All @@ -73,41 +79,40 @@ mysql connector is needed for mysql db generation:
*--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
<br>
> fake2db --rows 1500 --db postgresql --name test_database_postgre
<br>
> fake2db --db postgresql --rows 2500 --host container.local --password password --user docker
<br>
> fake2db --rows 200 --db sqlite --locale cs_CZ --seed 1337
<br>
`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
`fake2db --rows --db postgresql --port 15432`


##### Custom Database Generation
## 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
<br>
>fake2db.py --rows 1500 --db mysql --password randompassword --custom currency_code credit_card_full credit_card_provider
<br>
>fake2db.py --rows 20 --db mongodb --custom name date country
`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

<br>
##### Sample output - sqlite
![Screenshot](https://raw.github.com/emirozer/fake2db/master/docs/fake2db_example_sqlite.png)
<br>

![Screenshot](https://raw.github.com/emirozer/fake2db/master/docs/mysql_fake2db.png)
<br>


![Screenshot](https://raw.github.com/emirozer/fake2db/master/docs/pg_fake2db.png)

<br>

0 comments on commit a05bddb

Please sign in to comment.