Command
This class provides a command-line interface to run the native shell client for a specified database. It allows users to nominate a specific database connection and pass additional parameters directly to the underlying database executable. The class handles the execution process and provides error reporting if the required database client is missing or returns a non-zero exit status.
Attributes
| Attribute | Type | Description |
|---|---|---|
| help | string = "Runs the command-line client for specified database, or the default database if none is provided." | Runs the command-line client for specified database, or the default database if none is provided. |
| requires_system_checks | list = [] | A list of system checks that must be performed before the command is executed, which is empty for this command. |
Methods
add_arguments()
@classmethod
def add_arguments(
parser: ArgumentParser
)
Configures the argument parser to accept a target database alias and optional command-line parameters for the database client.
Parameters
| Name | Type | Description |
|---|---|---|
| parser | ArgumentParser | The argument parser instance to which the database and parameter arguments will be added. |
handle()
@classmethod
def handle(
**options: dict
)
Runs the command-line client for the specified database, or the default database if none is provided.
Parameters
| Name | Type | Description |
|---|---|---|
| **options | dict | A dictionary of command-line options, including the 'database' alias and a list of 'parameters' to pass to the client. |