Skip to content

Implement ScanQuery #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Implement ScanQuery #50

merged 2 commits into from
Jun 19, 2024

Conversation

LuckySting
Copy link
Contributor

Problem

For some reasons user may want to retrieve large amount of data from the table. Now it is possible only through the online read only transaction and it leads to TruncatedResponseError. Moreover such approach affects OLTP queries.

The YDB has special mechanism to do OLAP queries using snapshots called ScanQuery.

In this PR

In this PR I add an execution option to enable ScanQuery mode.

Example

with engine.begin() as connection:
    connection.execution_options(ydb_scan_query=True)  # Enable ScanQuery mode on connection
    cursor = connection.execute(sa.select(table))  # Fetch rows using ScanQuery
    
    for chunk in cursor.partitions(1000):  # gRPC stream iteration supported
        print(chunk)

@rekby rekby merged commit 8149b96 into ydb-platform:main Jun 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants