mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-10 18:44:20 +02:00
Add rows_to_csv() Python API helper for writing rows as CSV (issue #580)
The CLI can render query/table output as CSV via --csv, but the Python API had no equivalent. sqlite_utils.utils.rows_to_csv() takes rows from db.query() or table.rows/rows_where() and writes CSV to a file-like object, or returns it as a string, with a header row by default (skip with no_headers=True) to mirror the CLI's behavior.
This commit is contained in:
parent
71664b8fcf
commit
74c7038b8b
4 changed files with 105 additions and 0 deletions
|
|
@ -94,6 +94,13 @@ sqlite_utils.utils.rows_from_file
|
|||
|
||||
.. autofunction:: sqlite_utils.utils.rows_from_file
|
||||
|
||||
.. _reference_utils_rows_to_csv:
|
||||
|
||||
sqlite_utils.utils.rows_to_csv
|
||||
------------------------------
|
||||
|
||||
.. autofunction:: sqlite_utils.utils.rows_to_csv
|
||||
|
||||
.. _reference_utils_typetracker:
|
||||
|
||||
sqlite_utils.utils.TypeTracker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue