aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/db_helpers.py
blob: 6e1c2d2c15b9b6f7f57f94427b6b5af37f47a15c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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