> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Session.create_table()

<span id="atoti.Session.create_table" />

> Session.create\_table(<br />
>     *name*: [str](https://docs.python.org/3/library/stdtypes.html#str),<br />
>     \*,<br />
>     *data\_types*: Mapping\[ColumnName, DataType] = `frozendict({})`,<br />
>     *default\_values*: Mapping\[ColumnName, Constant | [None](https://docs.python.org/3/library/constants.html#None)] = `frozendict({})`,<br />
>     *keys*: AbstractSet\[ColumnName] | Sequence\[ColumnName] = `frozenset({})`,<br />
>     *partitioning*: [str](https://docs.python.org/3/library/stdtypes.html#str) | [None](https://docs.python.org/3/library/constants.html#None) = `None`,<br />
> ) → [Table](./atoti.Table#atoti.Table)

Create an empty table with columns of the given *data\_types*.

### Parameters

<h4 id="atoti.Session.create_table.name">
  *name*
</h4>

The name of the table to create.

<h4 id="atoti.Session.create_table.data_types">
  *data\_types*
</h4>

The table column names and their corresponding [`data type`](./atoti.type#module-atoti.type).

<h4 id="atoti.Session.create_table.default_values">
  *default\_values*
</h4>

Mapping from column name to column [`default_value`](./atoti.Column.default_value#atoti.Column.default_value).

<h4 id="atoti.Session.create_table.keys">
  *keys*
</h4>

The columns that will become [`keys`](./atoti.Table.keys#atoti.Table.keys) of the table.

If a [`Set`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Set) is given, the keys will be ordered as the table columns.

<h4 id="atoti.Session.create_table.partitioning">
  *partitioning*
</h4>

The definition of how the data will be split across partitions.

Default rules:

* Only non-joined tables are automatically partitioned.
* Tables are automatically partitioned by hashing their key columns.
  If there are no key columns, all the dictionarized columns are hashed.
* Joined tables can only use a sub-partitioning of the table referencing them.
* Automatic partitioning is done modulo the number of available cores.

For instance, `"modulo4(country)"` splits the data across 4 partitions based on the **country** column’s dictionarized value.

***

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> from datetime import date
>>> table = session.create_table(
...     "Product",
...     data_types={
...         "Date": "LocalDate",
...         "Product": "String",
...         "Quantity": "double",
...     },
...     keys={"Product", "Date"},
... )
>>> table.head()
Empty DataFrame
Columns: [Quantity]
Index: []
>>> {column_name: table[column_name].data_type for column_name in table}
{'Date': 'LocalDate', 'Product': 'String', 'Quantity': 'double'}
>>> table.keys
('Date', 'Product')
```
