Skip to content

Commit 5db5874

Browse files
committed
remove get affected rows check
In MySQL result, affected rows means the number of rows that get updated, but not the number of matched rows. So this can't be use as an indicator that if the rows actually exist.
1 parent 50daf3d commit 5db5874

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/gino/crud.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,6 @@ async def _execute_and_fetch(conn, query):
824824
)
825825
row = await conn.first(query)
826826
elif context.isupdate:
827-
if context.get_affected_rows() == 0:
828-
raise NoSuchRowError()
829827
table = context.compiled.statement.table
830828
if len(table.primary_key) > 0:
831829
lookup_conds = [

src/gino/dialects/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ def get_lastrowid(self):
414414
raise NotImplementedError
415415

416416
def get_affected_rows(self):
417+
# Note: in MySQL result, affected rows means the number of rows that get
418+
# updated, but not the number of matched rows.
417419
raise NotImplementedError
418420

419421

0 commit comments

Comments
 (0)