RegistryConfig

class lsst.daf.butler.registry.RegistryConfig(other: Config | str | ParseResult | ResourcePath | Path | Mapping[str, Any] | None = None, validate: bool = True, mergeDefaults: bool = True, searchPaths: Sequence[str | ParseResult | ResourcePath | Path] | None = None)

Bases: ConfigSubset

Configuration specific to a butler Registry.

Attributes Summary

component

Component to use from supplied config.

connectionString

Return the connection string to the underlying database (sqlalchemy.engine.url.URL).

defaultConfigFile

Name of the file containing defaults for this config class.

requiredKeys

Keys that are required to be specified in the configuration.

Methods Summary

getDatabaseClass()

Return the Database class targeted by configuration values.

getDialect()

Parse the db key of the config and returns the database dialect.

makeDefaultDatabaseUri(root)

Return a default 'db' URI for the registry configured here that is appropriate for a new empty repository with the given root.

replaceRoot(root)

Replace any occurrences of BUTLER_ROOT_TAG in the connection with the given root directory.

Attributes Documentation

component: ClassVar[str | None] = 'registry'

Component to use from supplied config. Can be None. If specified the key is not required. Can be a full dot-separated path to a component.

connectionString

Return the connection string to the underlying database (sqlalchemy.engine.url.URL).

defaultConfigFile: ClassVar[str | None] = 'registry.yaml'

Name of the file containing defaults for this config class.

requiredKeys: ClassVar[Sequence[str]] = ('db',)

Keys that are required to be specified in the configuration.

Methods Documentation

getDatabaseClass() type[lsst.daf.butler.registry.interfaces._database.Database]

Return the Database class targeted by configuration values.

The appropriate class is determined by parsing the db key to extract the dialect, and then looking that up under the engines key of the registry config.

getDialect() str

Parse the db key of the config and returns the database dialect.

Returns:
dialectstr

Dialect found in the connection string.

makeDefaultDatabaseUri(root: str) str | None

Return a default ‘db’ URI for the registry configured here that is appropriate for a new empty repository with the given root.

Parameters:
rootstr

Filesystem path to the root of the data repository.

Returns:
uristr

URI usable as the ‘db’ string in a RegistryConfig.

replaceRoot(root: ResourcePathExpression | None) None

Replace any occurrences of BUTLER_ROOT_TAG in the connection with the given root directory.

Parameters:
rootlsst.resources.ResourcePathExpression, or None

String to substitute for BUTLER_ROOT_TAG. Passing None here is allowed only as a convenient way to raise an exception (ValueError).

Raises:
ValueError

Raised if root is not set but a value is required.