graphcast.cli.manage_dbs
¶
Database management utilities for ArangoDB.
This module provides command-line tools for managing ArangoDB databases, including backup and restore operations. It supports both local and Docker-based operations.
Key Features
- Database backup and restore
- Docker and local execution modes
- Configurable connection settings
- Batch processing of multiple databases
Example
$ uv run manage_dbs --db-config-path config/db.yaml --db mydb1 mydb2 --store-directory-path /backups --use-docker
act_db(conf, db_name, output_path, restore, docker_version, use_docker)
¶
Execute database backup or restore operation.
This function performs either a backup (arangodump) or restore (arangorestore) operation on an ArangoDB database. It can use either the local arangodump/arangorestore tools or run them in a Docker container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conf
|
ArangoConnectionConfig
|
Database connection configuration |
required |
db_name
|
str
|
Name of the database to backup/restore |
required |
output_path
|
Path
|
Path where backup will be stored or restored from |
required |
restore
|
bool
|
Whether to restore (True) or backup (False) |
required |
docker_version
|
str
|
Version of ArangoDB Docker image to use |
required |
use_docker
|
bool
|
Whether to use Docker for the operation |
required |
Returns:
Type | Description |
---|---|
None |
Raises:
Type | Description |
---|---|
CalledProcessError
|
If the backup/restore operation fails |
Source code in graphcast/cli/manage_dbs.py
manage_dbs(db_config_path, db_host, db_password, db_user, db, store_directory_path, restore, docker_version, use_docker=True)
¶
Manage ArangoDB database backups and restores.
This command provides functionality to backup and restore ArangoDB databases. It supports both local execution and Docker-based operations. The command can process multiple databases in sequence and provides timing information for each operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db_config_path
|
Path to database configuration file (optional) |
required | |
db_host
|
Database host address (if not using config file) |
required | |
db_password
|
Database password (if not using config file) |
required | |
db_user
|
Database username (default: root) |
required | |
db
|
List of database names to process |
required | |
store_directory_path
|
Path where backups will be stored/restored |
required | |
restore
|
Whether to restore (True) or backup (False) |
required | |
docker_version
|
Version of ArangoDB Docker image (default: 3.12.1) |
required | |
use_docker
|
Whether to use Docker for operations (default: True) |
True
|
Example
$ uv run manage_dbs --db-config-path config/db.yaml --db mydb1 mydb2 --store-directory-path /backups --use-docker
Source code in graphcast/cli/manage_dbs.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|