I have a large amount of tuples I want to insert into a SQL db. I would like to find a way to chunk the insert statements into specified sizes like so:
qry: str = 'insert into test_db (test_col) values ()'
Now my source data is in an iterable of say 10M different values. I'd like to chunk this statement where for every n (chunk_size) values, I create a string statement like:
# Source data for example (single column)
l: list[int] = [i for i in range(0,10000000)]
qry: str = 'insert into test_db (test_col) values (1), (2), (3), ..., (n)'
This way, I could execute the above statement in parallel via a thread pool or the like, where each insert into
is executing a chunk_size of data into my sql db.