correction monetDB
This commit is contained in:
14
MonetDB.py
14
MonetDB.py
@@ -69,51 +69,63 @@ def create_table_monetdb():
|
||||
connect = connect_monetdb()
|
||||
with connect[0] as conn:
|
||||
with connect[1] as cursor:
|
||||
start_time = time.time()
|
||||
cursor.execute(createAirline)
|
||||
cursor.execute(createAirports)
|
||||
cursor.execute(createFlights)
|
||||
conn.commit()
|
||||
end_time = time.time()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except(pymonetdb.DatabaseError,Exception) as error:
|
||||
print(error)
|
||||
return end_time-start_time
|
||||
|
||||
def load_data_monetdb():
|
||||
try:
|
||||
connect = connect_monetdb()
|
||||
with connect[0] as conn:
|
||||
with connect[1] as cursor:
|
||||
start_time = time.time()
|
||||
cursor.execute(peuplementAirports)
|
||||
cursor.execute(peuplementAirlines)
|
||||
cursor.execute(peuplementFlights)
|
||||
conn.commit()
|
||||
end_time = time.time()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except(pymonetdb.DatabaseError,Exception) as error:
|
||||
print(error)
|
||||
return end_time-start_time
|
||||
|
||||
def requete_monetdb(str):
|
||||
try:
|
||||
connect=connect_monetdb()
|
||||
with connect[0] as conn:
|
||||
with connect[1] as cursor:
|
||||
start_time = time.time()
|
||||
cursor.execute(str)
|
||||
conn.commit()
|
||||
end_time = time.time()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except(pymonetdb.DatabaseError, Exception) as error:
|
||||
print(error)
|
||||
return end_time-start_time
|
||||
|
||||
def reset_data_monetdb():
|
||||
try:
|
||||
connect = connect_monetdb()
|
||||
with connect[0] as conn:
|
||||
with connect[1] as cursor:
|
||||
start_time = time.time()
|
||||
cursor.execute("DROP TABLE IF EXISTS airlines")
|
||||
cursor.execute("DROP TABLE IF EXISTS airports")
|
||||
cursor.execute("DROP TABLE IF EXISTS flights")
|
||||
conn.commit()
|
||||
end_time = time.time()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except(pymonetdb.DatabaseError, Exception) as error:
|
||||
print(error)
|
||||
print(error)
|
||||
return end_time-start_time
|
||||
Reference in New Issue
Block a user