zeroshade commented on issue #2084:
URL: https://github.com/apache/arrow-adbc/issues/2084#issuecomment-2297823150

   Okay, while the multiple calls to `adbc_ingest` would work, depending on 
various factors (how many sources, how large the records are, and so on) my 
recommendation would be to use a 
[generator/iterator](https://arrow.apache.org/docs/python/data.html#record-batch-readers)
 to construct a `RecordBatchReader` you can pass to `adbc_ingest` instead.
   
   ie. something like the following:
   
   ```python
   def process_record_batches(input):
       for batch in input:
           # whatever pre-processing you want to perform on the batch
           print(batch)
           yield batch
   
   with conn_read.cursor() as cursor_read:
           with conn_write.cursor() as cursor_write:
               
cursor_read.adbc_statement.set_options(**{"adbc.snowflake.rpc.prefetch_concurrency":
 2, "adbc.rpc.result_queue_size": 10})
               cursor_read.execute("SELECT * FROM T1")
               input = cursor_read.fetch_record_batch()
               reader = pyarrow.RecordBatchReader.from_batches(input.schema, 
process_record_batches(input))
               cursor_write.adbc_ingest("T2", reader, mode="append")
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to