diff --git a/MonetDB.py b/MonetDB.py index c2a773e..8ab2380 100644 --- a/MonetDB.py +++ b/MonetDB.py @@ -85,6 +85,7 @@ def reset_data_monetdb(connection,cursor): cursor.execute("DROP TABLE IF EXISTS airlines") cursor.execute("DROP TABLE IF EXISTS airports") cursor.execute("DROP TABLE IF EXISTS flights") + connection.commit() def disconnect_monetdb(connection,cursor): cursor.close() diff --git a/__pycache__/MonetDB.cpython-312.pyc b/__pycache__/MonetDB.cpython-312.pyc index c054bb8..605d50c 100644 Binary files a/__pycache__/MonetDB.cpython-312.pyc and b/__pycache__/MonetDB.cpython-312.pyc differ diff --git a/__pycache__/PostgreSQL.cpython-312.pyc b/__pycache__/PostgreSQL.cpython-312.pyc index d87f0c0..b2cd241 100644 Binary files a/__pycache__/PostgreSQL.cpython-312.pyc and b/__pycache__/PostgreSQL.cpython-312.pyc differ diff --git a/main.py b/main.py index 666bf1b..814a2ad 100644 --- a/main.py +++ b/main.py @@ -23,6 +23,14 @@ requeteDeletePostgreSQL = """DELETE FROM flights WHERE "DAY" > 10""" requeteInsertPostgreSQL = """INSERT INTO flights SELECT * FROM flights10""" +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__': #PostgreSQL #create_tables_postgres() @@ -31,7 +39,8 @@ if __name__ == '__main__': #MonetDB conn, cursor =connect_monetdb() - create_table_monetdb(conn,cursor) - #create_data_monetdb(conn,cursor) + #reset_data_monetdb(conn,cursor) + #create_table_monetdb(conn,cursor) + create_data_monetdb(conn,cursor) #requete_monetdb(conn,cursor, str) - #disconnect_monetdb(conn, cursor) + disconnect_monetdb(conn, cursor)