Command-line interface#
Database initialization utilities#
swh db init#
Initialize a database for the Software Heritage <module>.
The database connection string can come from the –dbname option, or from
the configuration file (see option --config-file
in swh db --help
)
in the section named after the MODULE argument in most cases.
For the case of the configuration key entry does not match the module name (e.g. module <storage.proxies.blocking> with a <blocking_admin> configuration key entry), use the –module-config-key flag to explicit the expected key entry to read the db information from (e.g. –module-config-key=blocking_admin).
Example:
$ cat conf.yml
storage:
cls: postgresql
db: postgresql://user:passwd@pghost:5433/swh-storage
objstorage:
cls: memory
$ swh db -C conf.yml init storage # or
$ SWH_CONFIG_FILENAME=conf.yml swh db init storage
$ # or
$ swh db init --dbname postgresql://user:passwd@pghost:5433/swh-storage storage
swh db init [OPTIONS] MODULE
Options
- -d, --dbname, --db-name <dbname>#
Database name or connection URI.
- --flavor <flavor>#
Database flavor.
- --module-config-key <module_config_key>#
Module config key to lookup.
Arguments
- MODULE#
Required argument
swh db-init#
Initialize a database for the Software Heritage <module>.
The database connection string can come from the –dbname option, or from
the configuration file (see option --config-file
in swh db --help
)
in the section named after the MODULE argument in most cases.
For the case of the configuration key entry does not match the module name (e.g. module <storage.proxies.blocking> with a <blocking_admin> configuration key entry), use the –module-config-key flag to explicit the expected key entry to read the db information from (e.g. –module-config-key=blocking_admin).
Example:
$ cat conf.yml
storage:
cls: postgresql
db: postgresql://user:passwd@pghost:5433/swh-storage
objstorage:
cls: memory
$ swh db -C conf.yml init storage # or
$ SWH_CONFIG_FILENAME=conf.yml swh db init storage
$ # or
$ swh db init --dbname postgresql://user:passwd@pghost:5433/swh-storage storage
swh db-init [OPTIONS] MODULE
Options
- -d, --dbname, --db-name <dbname>#
Database name or connection URI.
- --flavor <flavor>#
Database flavor.
- --module-config-key <module_config_key>#
Module config key to lookup.
Arguments
- MODULE#
Required argument