Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does asyncpg support using pg_service.conf for connection parameters? #1172

Open
CodeBardian opened this issue Aug 7, 2024 · 0 comments
Open

Comments

@CodeBardian
Copy link

  • asyncpg version: 0.29.0
  • PostgreSQL version: 16.2
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : local
  • Python version: 3.12
  • Platform: Win
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

I have a pg_service.conf (https://www.postgresql.org/docs/current/libpq-pgservice.html) that holds all required connection parameters.

[mydb]
host=localhost
port=5432
user=postgres
password=test

I can successfully connect with psycopg2 (or sqlalchemy) using
psycopg2.connect("postgresql://?service=mydb")

Using await asyncpg.connect("postgresql://?service=mydb") however always fails with

asyncpg.exceptions.ConnectionDoesNotExistError: connection was closed in the middle of operation

Also when using the same connection string in sqlachemy with asyncpg dialect, the connection call is converted to

await asyncpg.connect(service='mydb'), which also fails: connect() got an unexpected keyword argument 'service'

So therefore my general question, whether there is support for this type of connection in asyncpg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant