MagicStack / MagicStack/asyncpg
using notify listener with all-caps channel names
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hello,
I have a project where we set all our notify listeners up using all-caps channel names. In applying your package I found this didn't work, since the add_listener function sends the channel to postgres as a quoted identifier. I monkey patched as such to get it to work for my project:
async def add_listener(self, channel, callback, quote=True):
"""Add a listener for Postgres notifications.
:param str channel: Channel to listen on.
:param callable callback:
A callable receiving the following arguments:
**connection**: a Connection the callback is registered with;
**pid**: PID of the Postgres server that sent the notification;
**channel**: name of the channel the notification was sent to;
**payload**: the payload.
:param quote:
specifies the channel name should should be sent as quoted identifier
"""
self._check_open()
if not quote:
channel = channel.lower()
if channel not in self._listeners:
if quote:
await self.fetch('LISTEN {}'.format(utils._quote_ident(channel)))
else:
await self.fetch('LISTEN {}'.format(channel))
self._listeners[channel] = set()
self._listeners[channel].add(callback)
Would you consider a pull request with this change? I would think I am not the only one who uses the listeners this way.
Thanks!
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
add_listener と utils._quote_ident を検索し、その後、すべて大文字の PostgreSQL 通知チャネルを使って報告された動作を再現します。完了の条件は、すべて大文字のチャネルを登録して通知を受信でき、既存の listener の動作も維持されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100