import psycopg2


def test():
    # Connect to the PostgreSQL database
    conn = psycopg2.connect(dbname="childrensun_db")
    # Create a cursor object to execute SQL queries
    cur = conn.cursor()
    # Execute a SQL query to fetch data from a table
    cur.execute("SELECT * FROM childmonitoring_dayhospital")
    # Fetch all rows from the result set
    rows = cur.fetchall()
    # Print or process the fetched rows

    # Close the cursor and database connection
    cur.close()
    conn.close()
    return rows


for row in test():
    print(row)

