planemo.database package

Submodules

planemo.database.factory module

Create a DatabaseSource from supplied planemo configuration.

planemo.database.factory.create_database_source(profile_directory: str | None = None, for_database_commands: bool = False, **kwds) → DatabaseSource[source]

Return a planemo.database.interface.DatabaseSource for configuration.

planemo.database.factory.database_source_class(database_type)[source]

Return the database source class registered for database_type.

planemo.database.factory.database_source_context(profile_directory: str | None = None, for_database_commands: bool = False, **kwds)[source]

Yield a started database source and stop it when doing so preserves its data.

planemo.database.factory.is_managed_database_type(database_type)[source]

Return whether database_type names a registered database source.

planemo.database.factory.started_database_source(profile_directory: str | None = None, for_database_commands: bool = False, **kwds) → DatabaseSource[source]

Construct and start a planemo.database.interface.DatabaseSource.

planemo.database.interface module

Describe the interface classes of the planemo.database package.

exception planemo.database.interface.DatabaseConfigurationError[source]

Bases: ValueError

Indicate that a database source cannot support the requested operation.

class planemo.database.interface.DatabaseSource[source]

Bases: object

Interface describing a source of profile databases.

PROFILE_OPTIONS: tuple[str, ...] = ()
abstractmethod create_database(identifier)[source]

Create a database with specified short identifier.

Throw an exception if it already exists.

abstractmethod delete_database(identifier)[source]

Delete a database with specified short identifier.

Throw an exception if it does not exist.

keep_running_after_database_commands = False
abstractmethod list_databases()[source]

Return identifiers associated with database source.

profile_options()[source]

Return backend configuration that a persistent profile must retain.

abstractmethod sqlalchemy_url(identifier) → str | None[source]

Return a URL string for use by sqlalchemy.

start()[source]

Start the database source, if necessary.

stop()[source]

Stop the database source, if necessary.

store_connection_in_profile = True
classmethod validate_configuration(profile_directory=None, for_database_commands=False, **kwds)[source]

Validate backend-specific configuration before allocating resources.

planemo.database.postgres module

Module describes a DatabaseSource for local postgres databases.

class planemo.database.postgres.LocalPostgresDatabaseSource(**kwds)[source]

Bases: ExecutesPostgresSqlMixin, DatabaseSource

Local postgres database source managed through psql application.

sqlalchemy_url(identifier)[source]

Return URL or form postgresql://username:password@localhost/mydatabase.

planemo.database.postgres_docker module

Module describes a DatabaseSource for managed, dockerized postgres databases.

class planemo.database.postgres_docker.DockerPostgresDatabaseSource(**kwds)[source]

Bases: ExecutesPostgresSqlMixin, DatabaseSource

Postgres database running inside a Docker container.

keep_running_after_database_commands = True
sqlalchemy_url(identifier)[source]

Return URL or form postgresql://username:password@localhost/mydatabase.

start()[source]

Start the database source, if necessary.

stop()[source]

Stop the database source, if necessary.

planemo.database.postgres_singularity module

Manage a PostgreSQL server in a Singularity/Apptainer container.

class planemo.database.postgres_singularity.SingularityPostgresDatabaseSource(profile_directory: str | None = None, **kwds)[source]

Bases: ExecutesPostgresSqlMixin, DatabaseSource

Postgres database source running inside a Singularity container.

PROFILE_OPTIONS: tuple[str, ...] = ('postgres_storage_location', 'singularity_cmd', 'singularity_sudo', 'singularity_sudo_cmd')
profile_options()[source]

Return enough configuration to restart this profile’s container.

sqlalchemy_url(identifier)[source]

Return URL for PostgreSQL connection via Unix socket.

start()[source]

Start the database source, if necessary.

stop()[source]

Stop the database source, if necessary.

store_connection_in_profile = False
classmethod validate_configuration(profile_directory=None, for_database_commands=False, **kwds)[source]

Require stable storage for separate database administration commands.

Module contents

Package is responsible for managing planemo profile databases.

This package makes it very easy to create and destroy databases, therefore it should not be used for production data - and should not even be connnected to a production database server.

exception planemo.database.DatabaseConfigurationError[source]

Bases: ValueError

Indicate that a database source cannot support the requested operation.

planemo.database.create_database_source(profile_directory: str | None = None, for_database_commands: bool = False, **kwds) → DatabaseSource[source]

Return a planemo.database.interface.DatabaseSource for configuration.

planemo.database.database_source_class(database_type)[source]

Return the database source class registered for database_type.

planemo.database.database_source_context(profile_directory: str | None = None, for_database_commands: bool = False, **kwds)[source]

Yield a started database source and stop it when doing so preserves its data.

planemo.database.is_managed_database_type(database_type)[source]

Return whether database_type names a registered database source.

planemo.database.started_database_source(profile_directory: str | None = None, for_database_commands: bool = False, **kwds) → DatabaseSource[source]

Construct and start a planemo.database.interface.DatabaseSource.