rows_from_file() splits a single-column CSV file on a letter, or raises csv.Error
維護者通常 3 天內回覆
評估
研究方向
找到 rows_from_file(),並使用 issue 中顯示的 sqlite-utils memory 命令重現單欄 CSV 的情況。檢查分隔符偵測方式,然後執行相關的現有測試,並為包含標頭和 URL 的單欄 CSV 輸入新增測試涵蓋範圍。當未辨識到分隔符的檔案作為一欄匯入,且 insert --sniff 的行為維持不變時,工作即告完成。
由索引模型根據 Issue 內容生成。
描述
When rows_from_file() detects the format of a single-column CSV file, it either fails or splits the column on a letter. That affects sqlite-utils memory file.csv and any Python call that leaves format= unset.
$ printf 'name\nAnn\nBob\n' > names.csv
$ sqlite-utils memory names.csv "select * from names"
...
_csv.Error: Could not determine delimiter
$ printf 'url\nhttps://example.com/a\nhttps://example.org/b\n' > urls.csv
$ sqlite-utils memory urls.csv "select * from urls"
[{"ur": "https://examp", "": "e.com/a"},
{"ur": "https://examp", "": "e.org/b"}]
(sqlite-utils 4.2.1)
The detection calls csv.Sniffer().sniff() on the first 2048 bytes without a delimiters= list. The sniffer then treats any character as a candidate, so a file with a single column either has no consistent candidate (csv.Error) or has a letter that happens to repeat the same number of times on every line (l above).
A fix could sniff only for the delimiters a CSV file is realistically written with (,, ;, tab, |) and read the file as one column when none of them is found. insert --sniff calls the sniffer the same way, but that is an explicit request to detect the dialect, so I would leave it unchanged.
- 主要語言
- Python
- 星號
- 2.2k
- 分支
- 215
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
simonw/sqlite-utils 的其他 Issue
-
create_index exhausts iterator columns while deriving the index name可能已有人在做 @IlyaKhalafi 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
simonw/sqlite-utils#933 ·
維護者通常 3 天內回覆
-
FTS detection treats table names as LIKE patterns可能已有人在做 @IlyaKhalafi 於 3 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
simonw/sqlite-utils#930 ·
維護者通常 3 天內回覆
-
Contributing docs: local test runs silently skip SpatiaLite and ext.c tests, and the setup steps assume SSH and uv可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
simonw/sqlite-utils#928 ·
維護者通常 3 天內回覆
-
Tests use CliRunner.isolated_filesystem(), which is deprecated and will be removed in Click 9.0可能已有人在做 @devpryan7792 於 15 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
simonw/sqlite-utils#916 ·
維護者通常 3 天內回覆
-
enable_fts() exhausts iterator columns before populating the index可能已有人在做 @syahra712 於 29 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 83/100
simonw/sqlite-utils#902 ·
維護者通常 3 天內回覆
查看 simonw/sqlite-utils 的全部 Issue
相似的 Issue
-
`destroy` sans terminal répond « Aborted. » au lieu de réclamer `--yes` comme `clean` et `reset`未關閉bug
難度 2/5 1-3 小時 新手友好度 85/100
stephrobert/dsoxlab#354 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
jasonacox/pypowerwall#472 ·
維護者通常 1 天內回覆
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex fails可能已有人在做 @vrjdev 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
DoubleML/doubleml-for-py#455 ·
維護者通常 1 天內回覆
-
[Bug]: Python mod.Box[T] annotation gets a false generic_arg edge that replaces the parameter_type one ('is' on tree-sitter nodes)可能已有人在做 @rohit-jsfreaky 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
Graphify-Labs/graphify#5110 · 1 則留言 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
assafelovic/gpt-researcher#2277 ·
維護者通常 10 天內回覆