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 to use from supplied config.
Return the connection string to the underlying database (
sqlalchemy.engine.url.URL
).Name of the file containing defaults for this config class.
Keys that are required to be specified in the configuration.
Methods Summary
Return the
Database
class targeted by configuration values.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 theengines
key of the registry config.
- getDialect() str ¶
Parse the
db
key of the config and returns the database dialect.- Returns:
- dialect
str
Dialect found in the connection string.
- dialect
- 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:
- root
str
Filesystem path to the root of the data repository.
- root
- Returns:
- uri
str
URI usable as the ‘db’ string in a
RegistryConfig
.
- uri
- replaceRoot(root: ResourcePathExpression | None) None ¶
Replace any occurrences of
BUTLER_ROOT_TAG
in the connection with the given root directory.- Parameters:
- root
lsst.resources.ResourcePathExpression
, orNone
String to substitute for
BUTLER_ROOT_TAG
. PassingNone
here is allowed only as a convenient way to raise an exception (ValueError
).
- root
- Raises:
- ValueError
Raised if
root
is not set but a value is required.