Skip to content

Instantly share code, notes, and snippets.

View ketuls's full-sized avatar

Ketul Shah ketuls

View GitHub Profile
@ketuls
ketuls / postgres_generate.py
Last active August 29, 2015 14:13
This file inserts random image descriptors in Postgres DB. You need to change the conn_string as per your requirement. All the modules of import list needs to be installed to use this. Sample command would be "python postgres_generate.py <Number of records>" . Table Name is hardcoded as "img_des1"
import psycopg2
import json
import md5
import random
import sys
from datetime import datetime
conn_string= "host='localhost' dbname='postgres' user='ketulshah'"
conn= psycopg2.connect(conn_string)
@ketuls
ketuls / postgres_reader.py
Created January 7, 2015 10:48
This file reads the data inserted by postgres_generate.py. Time required to read the data is printed on terminal. Sample command would be "python postgres_reader.py <Number of records to be fetched>".
import psycopg2
import json
import md5
import couchdb
import random
import sys
from datetime import datetime
conn_string= "host='localhost' dbname='postgres' user='ketulshah'"
@ketuls
ketuls / couchdb_generate.py
Created January 7, 2015 10:53
This file inserts random image descriptors in Couch DB. # of records to be inserted is passed as argument. It assumes that couchdb is locally installed and running. All the modules of import list needs to be installed to use this. Sample command would be "python couchdb_generate.py <Number of records>" . Table Name will be "test"+<Numberofrecords>.
import json
import md5
import couchdb
import random
import sys
from datetime import datetime
count = int(sys.argv[1]);
couch = couchdb.Server()
@ketuls
ketuls / couchdb_reader.py
Created January 7, 2015 10:55
This file reads the data inserted by couchdb_generate.py. Time required to read the data is printed on terminal. Sample command would be "python couchdb_reader.py <# of records inserted> <# of records to be fetched>".
import json
import md5
import couchdb
import random
import sys
import couchdbkit
from datetime import datetime
count = int(sys.argv[1]);