Refer to "3.3 How to Use in libpq" and the description of the AsyncConnection class on the website of the Python package (psycopg) (https://www.psycopg.org/).