update all commands and havent tested
This commit is contained in:
@@ -103,5 +103,16 @@ def requete_postgres(str):
|
||||
print("Cette requête prends:", temps, "seconde")
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except (psycopg2.DatabaseError, Exception) as error:
|
||||
print(error)
|
||||
|
||||
def reset_database_postgres():
|
||||
try:
|
||||
with connect_postgres() as conn:
|
||||
with conn.cursor() as cursor:
|
||||
cursor.execute('DROP TABLE IF EXISTS flights,airlines,airports')
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
except (psycopg2.DatabaseError, Exception) as error:
|
||||
print(error)
|
||||
Reference in New Issue
Block a user