mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-27 03:14:33 +02:00
Handle empty lists
This commit is contained in:
parent
ace7a97b2b
commit
8daea7f126
1 changed files with 4 additions and 1 deletions
|
|
@ -977,7 +977,10 @@ class Table(Queryable):
|
|||
# we need to adjust the batch_size down if we have too many cols
|
||||
records = iter(records)
|
||||
# Peek at first record to count its columns:
|
||||
first_record = next(records)
|
||||
try:
|
||||
first_record = next(records)
|
||||
except StopIteration:
|
||||
return self # It was an empty list
|
||||
num_columns = len(first_record.keys())
|
||||
assert (
|
||||
num_columns <= SQLITE_MAX_VARS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue