|
|
|
@ -21,6 +21,13 @@ from getpass import getpass
|
|
|
|
|
|
|
|
|
|
################# Fin Tips #################
|
|
|
|
|
|
|
|
|
|
def create_tables(connection, filename: str):
|
|
|
|
|
cur = connection.cursor()
|
|
|
|
|
with open(filename) as f:
|
|
|
|
|
cur.execute(f.read())
|
|
|
|
|
connection.commit()
|
|
|
|
|
cur.close()
|
|
|
|
|
|
|
|
|
|
def Methode1(connection):
|
|
|
|
|
"""Exemple request"""
|
|
|
|
|
df = pand.read_sql("SELECT name_country, nbmusic FROM Top10MusiquesParPays", con=connection)
|
|
|
|
@ -44,5 +51,6 @@ if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
connection = psycopg2.connect(host=db_host, port=5432, database=db_name, user=db_user, password=db_password)
|
|
|
|
|
|
|
|
|
|
#create_tables(connection, 'Table.sql')
|
|
|
|
|
#Methode1(connection)
|
|
|
|
|
connection.close()
|