diff options
Diffstat (limited to 'webmentions_ssg/db_helpers.py')
| -rw-r--r-- | webmentions_ssg/db_helpers.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/webmentions_ssg/db_helpers.py b/webmentions_ssg/db_helpers.py new file mode 100644 index 0000000..6e1c2d2 --- /dev/null +++ b/webmentions_ssg/db_helpers.py @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Helpers for interpreting SQLAlchemy database results.""" + +from typing import Any, cast + +from sqlalchemy.engine import CursorResult, Result + + +def rows_affected(result: Result[Any]) -> int: + """Return the row count from a SQL UPDATE or DELETE result.""" + return cast(CursorResult[Any], result).rowcount |
