MaxNoichl commited on
Commit
f1adc40
·
1 Parent(s): 6d92dbc

Update pagination method in app.py to use 'page' for improved fallback handling in query results.

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -475,8 +475,8 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
475
  all_records = []
476
  records_count = 0
477
 
478
- # Use default cursor pagination for non-sampled queries
479
- for page in query.paginate(per_page=200, n_max=None):
480
  for record in page:
481
  all_records.append(record)
482
  records_count += 1
@@ -513,7 +513,7 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
513
  should_break_current_query = False
514
  # For "First n samples", limit the maximum records fetched to avoid over-downloading
515
  max_records_to_fetch = target_size if reduce_sample_checkbox and sample_reduction_method == "First n samples" else None
516
- for page in query.paginate(per_page=200, n_max=max_records_to_fetch):
517
  # Add retry mechanism for processing each page
518
  max_retries = 5
519
  base_wait_time = 1 # Starting wait time in seconds
 
475
  all_records = []
476
  records_count = 0
477
 
478
+ # Use page pagination for fallback method
479
+ for page in query.paginate(per_page=200, method='page', n_max=None):
480
  for record in page:
481
  all_records.append(record)
482
  records_count += 1
 
513
  should_break_current_query = False
514
  # For "First n samples", limit the maximum records fetched to avoid over-downloading
515
  max_records_to_fetch = target_size if reduce_sample_checkbox and sample_reduction_method == "First n samples" else None
516
+ for page in query.paginate(per_page=200, method='page', n_max=max_records_to_fetch):
517
  # Add retry mechanism for processing each page
518
  max_retries = 5
519
  base_wait_time = 1 # Starting wait time in seconds