Store#

featherstore.store.create_store(store_name, *, warnings='warn')[source]#

Creates a new store.

If a store with that name already exists, a warning is issued unless warnings='ignore', and the existing store is returned. This method does not raise StoreAlreadyExistsError.

Parameters:
  • store_name (str) – The name of the store to be created.

  • warnings (str, optional) – Whether to warn if the store already exists. Can be 'warn' or 'ignore'; 'ignore' passes silently if the store already exists. Default is 'warn'.

Returns:

The new or existing store.

Return type:

Store

Raises:
featherstore.store.rename_store(store_name, *, to)[source]#

Renames a store.

Parameters:
  • store_name (str) – The name of the store to be renamed.

  • to (str) – The new name of the store.

Raises:
featherstore.store.drop_store(store_name, *, warnings='warn')[source]#

Deletes a store.

Warning: You cannot delete a store containing tables. All tables must be deleted first.

Parameters:
  • store_name (str) – The name of the store to be deleted.

  • warnings (str, optional) – Whether to warn if the store does not exist. Can be 'warn' or 'ignore'. Default is 'warn'.

Raises:
featherstore.store.list_stores(*, like=None)[source]#

Lists stores in the database.

Parameters:

like (str, optional) – Filters store names with SQL wildcards. ? matches one character and % matches any number of characters. Matching is case-insensitive. Default is None.

Returns:

A list of the stores in the database.

Return type:

list

Raises:
featherstore.store.store_exists(store_name)[source]#

Returns whether a store exists in the current database.

Parameters:

store_name (str) – The name of the store.

Return type:

bool

Raises:
class featherstore.store.Store(store_name)[source]#

Bases: object

Provides common table operations within a store.

Stores are directories for organizing data in logical groups within your FeatherStore database.

name#

The name of the store. Updated when the store is renamed.

Type:

str

Selects an existing store.

Parameters:

store_name (str) – The name of the store to be selected.

Raises:
rename(*, to)[source]#

Renames the current store.

Parameters:

to (str) – The new name of the store.

Raises:
drop(*, warnings='warn')[source]#

Deletes the current store.

Warning: You cannot delete a store containing tables. All tables must be deleted first.

Parameters:

warnings (str, optional) – Whether to warn if the store does not exist. Can be 'warn' or 'ignore'. Default is 'warn'.

Raises:
list_tables(*, like=None)[source]#

Lists tables in the store.

Parameters:

like (str, optional) – Filters table names with SQL wildcards. ? matches one character and % matches any number of characters. Matching is case-insensitive. Default is None.

Returns:

A list of the tables in the store.

Return type:

list

Raises:
table_exists(table_name)[source]#

Returns whether a table exists in this store.

Parameters:

table_name (str) – The name of the table.

Return type:

bool

Raises:

See also

exists()

read_arrow(table_name, *, cols=None, rows=None, mmap=None)[source]#

Reads a table as a PyArrow Table.

Parameters:
Return type:

pyarrow.Table

Raises:

See also

read_arrow()

read_pandas(table_name, *, cols=None, rows=None, mmap=None)[source]#

Reads a table as a pandas DataFrame or Series.

Parameters:
Return type:

pandas.DataFrame or pandas.Series

Raises:

See also

read_pandas()

read_polars(table_name, *, cols=None, rows=None, mmap=None)[source]#

Reads a table as a polars DataFrame or Series.

Parameters:
Return type:

polars.DataFrame or polars.Series

Raises:

See also

read_polars()

write_table(table_name, df, /, index=None, *, partition_size=134217728, errors='raise', warnings='warn')[source]#

Writes a DataFrame to the current store as a partitioned table.

Parameters:
  • table_name (str) – The name of the table the DataFrame will be stored as.

  • df (pandas.DataFrame or pandas.Series, polars.DataFrame or polars.Series, or pyarrow.Table) – See write().

  • index (str, optional) – See write().

  • partition_size (int, optional) – See write().

  • errors (str, optional) – See write().

  • warnings (str, optional) – See write().

Raises:

See also

write()

append_table(table_name, df, *, warnings='warn')[source]#

Appends data to a table.

Parameters:
  • table_name (str) – The name of the table to append to.

  • df (pandas.DataFrame or pandas.Series, polars.DataFrame or polars.Series, or pyarrow.Table) – See append().

  • warnings (str, optional) – See append().

Raises:

See also

append()

rename_table(table_name, *, to)[source]#

Renames a table.

Parameters:
  • table_name (str) – The name of the table to be renamed.

  • to (str) – The new name of the table.

Raises:

See also

rename_table()

drop_table(table_name, *, warnings='warn')[source]#

Deletes a table.

Parameters:
  • table_name (str) – The name of the table to be deleted.

  • warnings (str, optional) – Whether to warn if the table does not exist. Can be 'warn' or 'ignore'. Default is 'warn'.

Raises:

See also

drop_table()

select_table(table_name)[source]#

Selects a single table.

Table objects have more features for editing stored tables.

Parameters:

table_name (str) – The name of the table to return.

Return type:

Table

Raises:

See also

Table

create_snapshot(path)[source]#

Creates a compressed backup of the store.

The store can later be restored with restore_store().

Parameters:

path (str) – Path to the snapshot archive. .tar.xz is appended unless path already ends with that suffix. An existing file at the resulting path is overwritten.

Raises: