zut.tabular_dumper
- zut.tabular_dumper(dst: str | Path | IOBase | DbAdapter | Connection | None = None, *, headers: Iterable[str | Header] | None = None, truncate: bool = None, archivate: bool | str | Path | None = None, title: str | bool | None = None, dst_name: str | bool = True, dir: str | Path = None, delay: bool = False, optional: str | Sequence[str] | Literal['*', True] | None = None, add_columns: bool | Literal['warn'] = False, after1970: bool | None = None, notz: bool | tzinfo | str | None = None, encoding: str | None = None, intfmt: str | None = None, floatfmt: str | None = None, delimiter: str | None = None, decimal_separator: str | None = None, quotechar: str | None = None, nullval: str | None = None, excel: bool | None = None, table: str | tuple | None = None, add_autoincrement_pk: bool | str = False, **kwargs)
Export tabular data, in CSV format, or using tabulate.
Options:
delay: if True, wait the end of the context to determine headers (based on appended dictionnaries) and start outputing. This only applies if we’re not appending to an existing file.
optional: list of header names that are expected but might not be given as keys of the first appended dict row.
- notz: transform all aware (= with timezone info) datetimes into naive (= timezone info removed), expressing them in the given timezone:
Use True for local timezone (this is the default for CSV excel exports).
Use False to keep aware datetimes unchanged (this is the default for other exports).
NOTE: empty strings are written with double quotes (“”) in order to distinguish them from NULL values (written as an unquoted string). This is compatible with PostgreSQL’s COPY FROM command.