MagicStack / MagicStack/asyncpg

Await connection in debugpy

オープン
#1,005 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

  • asyncpg version: 0.27.0
  • PostgreSQL version: 15.1
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :
  • Python version: 3.11
  • Platform: starlite
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: poetry
  • If you built asyncpg locally, which version of Cython did you use?: n/a
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : not sure

So I am using debugpy for debugging in vscode. Essentially this: python -m debugpy --listen 0.0.0.0:5678 ./myscript.py
I am using asyncpg + sqlalchemy. Specifically an AsyncSession

When I set a breakpoint and use the debug console I can normally await async functions.
But when I do this on an async query I get this error:

app_dev  | Traceback (most recent call last):
app_dev  |   File "/usr/local/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 755, in _start_transaction
app_dev  |     await self._transaction.start()
app_dev  |   File "/usr/local/lib/python3.11/site-packages/asyncpg/transaction.py", line 138, in start
app_dev  |     await self._connection.execute(query)
app_dev  |   File "/usr/local/lib/python3.11/site-packages/asyncpg/connection.py", line 317, in execute
app_dev  |     return await self._protocol.query(query, timeout)
app_dev  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app_dev  |   File "asyncpg/protocol/protocol.pyx", line 323, in query
app_dev  |   File "asyncpg/protocol/protocol.pyx", line 707, in asyncpg.protocol.protocol.BaseProtocol._check_state
app_dev  | asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

Is there a way I can await async queries in the debug console?
Please let me know if this is a sqlAlchemy issue.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Python 3.11、asyncpg 0.27.0、PostgreSQL 15.1、SQLAlchemy AsyncSession を使って debugpy コマンドを再現し、その後、並行操作エラーの発生元を調査します。その挙動が asyncpg、SQLAlchemy、debugpy のいずれに属するのかを特定してください。完了には、修正が確認されているか、明確に文書化された解決策が必要です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python, sqlalchemy, vscode
領域
databases, devtools
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。