GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Async :many codegen breaks for DML + RETURNING queries (uses .stream() server-side cursor) · Issue #101 · sqlc-dev/sqlc-gen-python Open DescriptionSummaryFor The sync codepath uses Reproducer
CREATE TABLE widgets ( id BIGSERIAL PRIMARY KEY, counter INT NOT NULL DEFAULT 0 );
-- name: BumpWidgets :many WITH selected AS ( SELECT id FROM widgets WHERE counter < $1 LIMIT $2 ) UPDATE widgets SET counter = widgets.counter + 1 FROM selected WHERE widgets.id = selected.id RETURNING widgets.id, widgets.counter;
version: "2" plugins: - name: py wasm: url: https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.3.0.wasm sha256: fbedae96b5ecae2380a70fb5b925fd4bff58a6cfb1f3140375d098fbab7b3a3c sql: - schema: "schema.sql" queries: "queries.sql" engine: postgresql codegen: - plugin: py out: gen options: package: gen emit_async_querier: true emit_sync_querier: false Generated wrapper (abridged): async def bump_widgets(self, *, threshold: int, limit: int) -> AsyncIterator[models.Widget]: result = await self._conn.stream( sqlalchemy.text(BUMP_WIDGETS), {"p1": threshold, "p2": limit} ) async for row in result: yield models.Widget(id=row[0], counter=row[1]) Calling it raises: ExpectedAsync WorkaroundBypass the generated wrapper and run the SQL through Suggested fix directionThe bug is isolated to the async Happy to send a PR if there's interest. Environment
Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |