Exemple #1
0
def get_all():
    
    db = ConnectionPool(DB_HOSTS)
    per_num = 10**14
    
    #10090567193265
    
    scan_sum = 0
    begin_time = time.asctime()
    while 1:
        max_tid = server.incr("token_id", per_num)
        print max_tid, scan_sum, begin_time, time.asctime()
        with db.connection() as cur:
            cur.execute('''select * from ataobao2.item_by_date where token(id)>=:start and token(id)<:end''', 
                        dict(start=max_tid - per_num, end=max_tid), consistency_level='ONE')
Exemple #2
0
def get_all():

    db = ConnectionPool(DB_HOSTS)
    per_num = 10**14

    #10090567193265

    scan_sum = 0
    begin_time = time.asctime()
    while 1:
        max_tid = server.incr("token_id", per_num)
        print max_tid, scan_sum, begin_time, time.asctime()
        with db.connection() as cur:
            cur.execute(
                '''select * from ataobao2.item_by_date where token(id)>=:start and token(id)<:end''',
                dict(start=max_tid - per_num, end=max_tid),
                consistency_level='ONE')
Exemple #3
0
 def __init__(self):
   mongo = connection().connect()
   db = mongo["slowlytime"] 
   self.__db = db