atoti.Table.keys#

property Table.keys: Sequence[str]#

Names of the key columns of the table.

Inserting a row containing key values equal to the ones of an existing row will replace the existing row with the new one:

>>> table = session.create_table(
...     "Example",
...     keys=["Country", "City"],
...     types={
...         "Country": "String",
...         "City": "String",
...         "Year": "int",
...         "Population": "int",
...     },
... )
>>> table.keys
('Country', 'City')
>>> table += ("France", "Paris", 2000, 9_737_000)
>>> table += ("United States", "San Diego", 2000, 2_681_000)
>>> table.head().sort_index()
                         Year  Population
Country       City
France        Paris      2000     9737000
United States San Diego  2000     2681000
>>> table += ("France", "Paris", 2024, 11_277_000)
>>> table.head().sort_index()
                         Year  Population
Country       City
France        Paris      2024    11277000
United States San Diego  2000     2681000

Key columns cannot have None as their default_value.