ajout de fonction dans le main
This commit is contained in:
@@ -85,6 +85,7 @@ def reset_data_monetdb(connection,cursor):
|
|||||||
cursor.execute("DROP TABLE IF EXISTS airlines")
|
cursor.execute("DROP TABLE IF EXISTS airlines")
|
||||||
cursor.execute("DROP TABLE IF EXISTS airports")
|
cursor.execute("DROP TABLE IF EXISTS airports")
|
||||||
cursor.execute("DROP TABLE IF EXISTS flights")
|
cursor.execute("DROP TABLE IF EXISTS flights")
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
def disconnect_monetdb(connection,cursor):
|
def disconnect_monetdb(connection,cursor):
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|||||||
14
main.py
14
main.py
@@ -32,6 +32,14 @@ def execMoneDB(conn,cursor,str):
|
|||||||
requete_monetdb(conn,cursor, str)
|
requete_monetdb(conn,cursor, str)
|
||||||
|
|
||||||
|
|
||||||
|
def display_table(data, headers):
|
||||||
|
max_len = max(len(header) for header in headers)
|
||||||
|
print(" | ".join(header.ljust(max_len) for header in headers))
|
||||||
|
sep = "-" * max_len
|
||||||
|
print("-|-".join(sep for _ in headers))
|
||||||
|
for row in data:
|
||||||
|
print(" | ".join(header.ljust(max_len) for header in row))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#PostgreSQL
|
#PostgreSQL
|
||||||
#create_tables_postgres()
|
#create_tables_postgres()
|
||||||
@@ -42,8 +50,4 @@ if __name__ == '__main__':
|
|||||||
conn, cursor =connect_monetdb()
|
conn, cursor =connect_monetdb()
|
||||||
initMoneDB(conn,cursor)
|
initMoneDB(conn,cursor)
|
||||||
execMoneDB(conn,cursor,requeteSelect1MonetDB)
|
execMoneDB(conn,cursor,requeteSelect1MonetDB)
|
||||||
disconnect_monetdb(conn, cursor)
|
disconnect_monetdb(conn, cursor)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user