@@ -148,3 +148,46 @@ def check_transaction(s: ydb.table.Session):
148148 assert rs [0 ].rows [0 ].cnt == 1
149149
150150 pool .retry_operation_sync (check_transaction )
151+
152+
153+ def test_truncated_response (driver_sync , table_name , table_path ):
154+ column_types = ydb .BulkUpsertColumns ().add_column ("id" , ydb .PrimitiveType .Int64 )
155+
156+ rows = []
157+
158+ rows_count = 1100
159+ for i in range (rows_count ):
160+ rows .append ({"id" : i })
161+
162+ driver_sync .table_client .bulk_upsert (table_path , rows , column_types )
163+
164+ table_client = (
165+ driver_sync .table_client
166+ ) # default table client with driver's settings
167+ s = table_client .session ()
168+ s .create ()
169+ t = s .transaction ()
170+ with pytest .raises (ydb .TruncatedResponseError ):
171+ t .execute ("SELECT * FROM %s" % table_name )
172+
173+
174+ def test_truncated_response_allow (driver_sync , table_name , table_path ):
175+ column_types = ydb .BulkUpsertColumns ().add_column ("id" , ydb .PrimitiveType .Int64 )
176+
177+ rows = []
178+
179+ rows_count = 1100
180+ for i in range (rows_count ):
181+ rows .append ({"id" : i })
182+
183+ driver_sync .table_client .bulk_upsert (table_path , rows , column_types )
184+
185+ table_client = ydb .TableClient (
186+ driver_sync , ydb .TableClientSettings ().with_allow_truncated_result (True )
187+ )
188+ s = table_client .session ()
189+ s .create ()
190+ t = s .transaction ()
191+ result = t .execute ("SELECT * FROM %s" % table_name )
192+ assert result [0 ].truncated
193+ assert len (result [0 ].rows ) == 1000
0 commit comments