Subversion Repositories SmartDukaan

Rev

Rev 17323 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17323 Rev 20689
Line 312... Line 312...
312
        insertsql="insert into userlinkssegmentation7days (user_id, brand, category_id, source, count,weight) values(%s, %s, %s, %s, %s,%s)"
312
        insertsql="insert into userlinkssegmentation7days (user_id, brand, category_id, source, count,weight) values(%s, %s, %s, %s, %s,%s)"
313
        cursor = conn.cursor()
313
        cursor = conn.cursor()
314
        cursor.execute(insertsql,(userId,brand,category,'product_view',r[0],r[1]))
314
        cursor.execute(insertsql,(userId,brand,category,'product_view',r[0],r[1]))
315
        conn.commit()        
315
        conn.commit()        
316
        
316
        
317
def get_mongo_connection_new(host='45.33.50.227', port=27017):
317
def get_mongo_connection_new(host='192.168.161.154', port=27017):
318
    global con
318
    global con
319
    if con is None:
319
    if con is None:
320
        print "Establishing connection %s host and port %d" %(host,port)
320
        print "Establishing connection %s host and port %d" %(host,port)
321
        try:
321
        try:
322
            con = pymongo.MongoClient(host, port)
322
            con = pymongo.MongoClient(host, port)