atoti.Session.read_csv()#
- Session.read_csv(path, /, *, array_separator=None, client_side_encryption=None, columns={}, data_types={}, date_patterns={}, default_values={}, encoding='utf-8', keys=frozenset({}), partitioning=None, process_quotes=True, separator=',', table_name=None, **kwargs)#
Read a CSV file into a table.
Note
This is just a shortcut for:
csv_load = tt.CsvLoad(path, ...) data_types = session.tables.infer_data_types(csv_load) table = session.create_table( table_name, data_types={**inferred_data_types, **data_types}, default_values=..., keys=..., partitioning=..., ) table.load(csv_load)
The longer version unlocks better performance because it can be split to move the
load()
call inside adata_transaction()
.- Parameters:
array_separator (str | None) – See
atoti.CsvLoad.array_separator
.client_side_encryption (ClientSideEncryptionConfig | None) – See
atoti.CsvLoad.client_side_encryption
.columns (Mapping[str, str] | Sequence[str]) – See
atoti.CsvLoad.columns
.data_types (Mapping[str, DataType]) – The data types for some or all columns of the table. Data types for non specified columns will be inferred from the first 1,000 lines.
date_patterns (Mapping[str, str]) – See
atoti.CsvLoad.date_patterns
.default_values (Mapping[str, bool | int | float | date | datetime | time | Sequence[bool] | Sequence[int] | Sequence[float] | Sequence[str] | str | None]) – See
create_table()
’s default_values.encoding (str) – See
atoti.CsvLoad.encoding
.keys (Set[str] | Sequence[str]) – See
create_table()
’s keys.partitioning (str | None) – See
create_table()
’s partitioning.path (Path | str) – See
atoti.CsvLoad.path
.process_quotes (bool | None) – See
atoti.CsvLoad.process_quotes
.separator (str | None) – See
atoti.CsvLoad.separator
.table_name (str | None) – See
create_table()
’s name.kwargs (Unpack[_ReadCsvPrivateParameters])
- Return type: