tortoise / tortoise/tortoise-orm

UPDATE and DELETE synopsises also may include WITH statements

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

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Describe the bug
https://github.com/tortoise/tortoise-orm/blob/develop/tortoise/backends/asyncpg/client.py#L135
UPDATE and DELETE synopsises also may include WITH statements. So L135 is wrong i think.
may be replace it with code below?
if "UPDATE" in query or "DELETE" in query:

To Reproduce
Run execute_query with WITH statement

Expected behavior
UPDATE and DELETE queries should executed, not fetched i think

Contributor guide

Open the contributing guide

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 in tortoise/backends/asyncpg/client.py at line 135 and inspect how execute_query classifies statements. Reproduce the issue with an UPDATE or DELETE query containing a WITH statement, then verify those queries execute rather than being fetched.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.