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:
NotADatabaseError – If
connection_stringis not a FeatherStore database.IncompatibleDatabaseVersionError – If the database format versions are incompatible with this install.
TypeError – If
connection_stringis 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.
~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:
PopulatedDirectoryError – If
errors='raise'and the directory is not empty.TypeError – If
pathis not a str.ValueError – If
errorsis not'raise'or'ignore'.
- 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:
- Raises:
NotConnectedError – If FeatherStore is not connected to a database.
DatabaseNotEmptyError – If the database still contains stores.
TypeError – If
pathis not a str.ValueError – If
warningsis not'warn'or'ignore', or ifpathis not the currently connected database.
- featherstore.connection.current_db()[source]#
Returns the path of the active database.
- Returns:
The current database directory.
- Return type:
- Raises:
NotConnectedError – If FeatherStore is not connected to a database.