zut.db.base.ExecuteResult

class zut.db.base.ExecuteResult(db: Db[T_Connection, T_Cursor], sql: str | None = None, params: Mapping[str, Any] | Sequence[Any] | None = None, *, limit: int | None = None, offset: int | None = None, source: str | None = None, warn_if_result: bool | int | Literal['not-last'] = False)

Bases: CursorResult[T_Cursor], Generic[T_Connection, T_Cursor]

__init__(db: Db[T_Connection, T_Cursor], sql: str | None = None, params: Mapping[str, Any] | Sequence[Any] | None = None, *, limit: int | None = None, offset: int | None = None, source: str | None = None, warn_if_result: bool | int | Literal['not-last'] = False)

Methods

__init__(db[, sql, params, limit, offset, ...])

dump_csv(file, *[, fmt, encoding, append, delay])

dump_csv_temp(*[, fmt, encoding, append, delay])

get_dict()

get_dicts()

get_namedtuple()

get_namedtuples()

get_row()

get_rows()

get_scalar(*[, type, notnull])

get_scalars(*[, type, notnull])

iter_dicts()

iter_namedtuples()

iter_rows()

iter_scalars(*[, type, notnull])

print_tabulate(*[, file])

single_dict()

single_namedtuple()

single_row()

single_scalar(*[, type, notnull])

tabulate(**kwargs)

Attributes

columns

cursor

lastrowid

The rowid of the last inserted row.

length

Return the number of rows in the result set.

next_num

rowcount

The number of rows modified by the last SQL statement.

property lastrowid

The rowid of the last inserted row. None if no inserted rowid.

NOTE: If several row where inserted, MySQL and MariaDB return the id of the last row inserted, whereas PostgreSql, SqlServer and SQLite return the id of the first row inserted.

property length: int

Return the number of rows in the result set.

To get the number of rows modified by the last SQL statement, use rowcount instead.

property rowcount: int | None

The number of rows modified by the last SQL statement. None if the number of rows is unknown or unavailable.

To get the number of rows in the result set, use length instead.