atoti.Session.read_csv()#
- Session.read_csv(path, /, *, array_separator=None, client_side_encryption=None, columns=frozendict({}), data_types=frozendict({}), date_patterns=frozendict({}), default_values=frozendict({}), encoding='utf-8', keys=frozenset({}), partitioning=None, process_quotes=True, separator=',', table_name=None, true_values=frozenset({}), false_values=frozenset({}), **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, ColumnName] | Sequence[ColumnName]) – See
atoti.CsvLoad.columns
.data_types (Mapping[ColumnName, 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[ColumnName, str]) – See
atoti.CsvLoad.date_patterns
.default_values (Mapping[ColumnName, Constant | None]) – See
create_table()
’s default_values.encoding (str) – See
atoti.CsvLoad.encoding
.false_values (AbstractSet[Any]) – See
atoti.CsvLoad.false_values
.keys (AbstractSet[ColumnName] | Sequence[ColumnName]) – 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 (TableName | None) – See
create_table()
’s name.true_values (AbstractSet[Any]) – See
atoti.CsvLoad.true_values
.kwargs (Unpack[_ReadCsvPrivateParameters])
- Return type: