This is my first question here, so thanks in advance to anyone replying to this humble student.
I'm trying to define a function using psycopg2. I have split into two stages. First the parameters necessary for connection, which I managed to read through documentation and solve. Now, my issue is dealing with the query to pass it through the function. Ex:
def databasequery(database, user, password, host, port):
psycopg2.connect(
database=database,
user=user,
password=password,
host=host,
port=port,
)
conn = get_connection()
curr = conn.cursor()
print(databasequery("Select * from customers", "your_database","your_user","your_password","your_host","your_port"))
How can I add the query to pass through the function?
Make suitable changes as needed