MagicStack / MagicStack/asyncpg

Feature request: A connection property to retreive host name used in specific connection

Open
#1,213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

When multiples hosts are specified, either pool or connection could use any of them (depending on target_session_attrs).

It would be nice to have a way to retrieve the actual (connected) host name, as it was provided in the list, that was used to create a specific connection.

Currently, I found no easy way how to do this. Of course, it is possible to use `SELECT inet_server_addr()` but this only returns an address, which is not always useful.

Thank you!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing asyncpg's connection and pool APIs, focusing on how multiple hosts and target_session_attrs select a connection. Define what the returned host name should represent, then verify the result against the host list for connections created through both supported paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.