Database and Connection#

featherstore.connection.connect(connection_string)[source]#

Connects to a database.

If a connection is already open, it is replaced.

Parameters:

connection_string (str) – Path to the database directory. ~ is expanded to the user home directory.

Raises:
featherstore.connection.disconnect()[source]#

Disconnects from the current database.

Raises:

NotConnectedError – If FeatherStore is not connected to a database.

featherstore.connection.create_database(path, *, errors='raise', connect=True)[source]#

Creates a new database.

Parameters:
  • path (str) – Where to create the database. ~ is expanded to the user home directory.

  • errors (str, optional) – Whether to raise an error if the database directory already exists. Can be 'raise' or 'ignore'; 'ignore' tries to create a database in an existing directory. Default is 'raise'.

  • connect (bool, optional) – Whether to connect to the created database. Default is True. A new connection replaces any existing connection.

Raises:
featherstore.connection.drop_database(path, *, warnings='warn')[source]#

Deletes a database.

Warning: You cannot delete a database containing stores. All stores must be deleted first.

On success, FeatherStore disconnects from the deleted database.

Parameters:
  • path (str) – Path to the database directory. Must be the currently connected database. ~ is expanded to the user home directory.

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

Raises:
featherstore.connection.current_db()[source]#

Returns the path of the active database.

Returns:

The current database directory.

Return type:

str

Raises:

NotConnectedError – If FeatherStore is not connected to a database.

featherstore.connection.is_connected()[source]#

Returns whether FeatherStore is connected to a database.

Return type:

bool

featherstore.connection.database_exists(path)[source]#

Returns whether a directory is a FeatherStore database.

Parameters:

path (str) – Path to the directory to check. ~ is expanded to the user home directory.

Returns:

True if the directory contains a FeatherStore database marker.

Return type:

bool