mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-13 12:54:12 +02:00
parent
ebb04a97de
commit
25c632fbbc
2 changed files with 9 additions and 0 deletions
|
|
@ -373,6 +373,8 @@ def rows_from_file(
|
|||
raise TypeError(
|
||||
"rows_from_file() requires a file-like object that supports peek(), such as io.BytesIO"
|
||||
)
|
||||
if not first_bytes:
|
||||
return (), Format.CSV
|
||||
if first_bytes.startswith((b"[", b"{")):
|
||||
# TODO: Detect newline-JSON
|
||||
return rows_from_file(buffered, format=Format.JSON)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue