Skip to content

Support row count for DML queries #319

@mdesmet

Description

@mdesmet

Describe the feature

Row count is exposed by the Trino engine when doing DML queries:

trino> create table iceberg.default.test AS SELECT 1 a;
CREATE TABLE: 1 row

Query 20230109_192533_00333_sy494, FINISHED, 1 node
Splits: 18 total, 18 done (100,00%)
1,88 [0 rows, 0B] [0 rows/s, 0B/s]

trino> INSERT INTO iceberg.default.test (a) values (2);
INSERT: 1 row

This information is not exposed in the Trino Python Client.

It would be nice to expose this information.

DBAPI spec also mentions the following:

.rowcount
This read-only attribute specifies the number of rows that the last .execute*() produced (for DQL statements like SELECT) or affected (for DML statements like UPDATE or INSERT). [9]
The attribute is -1 in case no .execute*() has been performed on the cursor or the rowcount of the last operation is cannot be determined by the interface. [7]

Describe alternatives you've considered

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions