its starting to get stable
This commit is contained in:
+14
-10
@@ -23,19 +23,23 @@ def get_client():
|
||||
return write_client
|
||||
def writeEXData():
|
||||
db = create_engine(posturl)
|
||||
conn = db.connect()
|
||||
|
||||
df=pd.DataFrame(EXBooksData)
|
||||
df.to_sql('cx_books', con=conn, if_exists='replace',
|
||||
index=False)
|
||||
types=df.dtypes
|
||||
start=time.time()
|
||||
df.to_sql('cx_books', con=db, if_exists='replace',
|
||||
index=False,chunksize=200000)
|
||||
t1=time.time()
|
||||
print(f"cx_books completed: {t1-start}/{df.size}")
|
||||
df=pd.DataFrame(EXTradeData)
|
||||
df.to_sql("cx_trades",con=conn, if_exists='replace',
|
||||
index=False)
|
||||
conn.close()
|
||||
df.to_sql("cx_trades",con=db, if_exists='replace',
|
||||
index=False,chunksize=10000)
|
||||
t2=time.time()
|
||||
print(f"cx_trades completed: {t2-t1}/{df.size}")
|
||||
|
||||
def writeBusinessData():
|
||||
db = create_engine(posturl)
|
||||
conn = db.connect()
|
||||
df=pd.DataFrame(BUSINESSData)
|
||||
df.to_sql('business', con=conn, if_exists='replace',
|
||||
index=False)
|
||||
conn.close()
|
||||
df.to_sql('business', con=db, if_exists='replace',
|
||||
index=False,chunksize=10000)
|
||||
print(f"business completed: {df.size}")
|
||||
|
||||
Reference in New Issue
Block a user