Database and Connection#

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

Connects to a database.

Parameters:

connection_string (str) – Path to the database directory

Raises:
  • NotADatabaseError – If connection_string is not a FeatherStore database.

  • TypeError – If connection_string is not a str.

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.

  • errors (str, optional) – Whether or not to raise an error if the database directory already exist. Can be either raise or ignore, ignore tries to create a database in existing directory, by default raise

  • connect (bool) – Whether or not to connect to the created database, by default True

Raises:
  • PopulatedDirectoryError – If errors='raise' and the directory is not empty.

  • TypeError – If db_path is not a str.

  • ValueError – If errors is not 'raise' or 'ignore'.

featherstore.connection.current_db()[source]#

Fetches 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]#

Checks if FeatherStore is connected to a database.

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

Checks whether a directory is a FeatherStore database.

Parameters:

path (str) – Path to the directory to check.

Returns:

True if the directory contains a FeatherStore database marker.

Return type:

bool

class featherstore.connection.Connection(*args, **kwargs)[source]#

Bases: object

classmethod disconnect()[source]#
classmethod location()[source]#
classmethod is_connected()[source]#