dhconfig schemas
The schemas configuration data type of the dhconfig tool is used to manage schemas in the system, with actions import, edit, export, list, and delete.
As with other dhconfig configuration data types, the --help argument provides detailed information on the available actions and arguments, as well as usage examples. Use --help whenever you need more information about the available actions. For example, if you want information about the import action, you can run:
Which prints the following:
A description of all the subcommand's options and some usage examples follows.
Due to the number of available actions and combinations, and the robust in-tool documentation via --help, an exhaustive list of all possible commands is not provided here. Instead, we will elaborate on some of the more complex arguments below, and then give some usage examples. We recommend that you use the --help argument as needed for more information.
Arguments
Each action accepts only a subset of these arguments; run the action with --help to see which apply. For actions that expose --file, trailing arguments are treated as --file arguments. The short option -e means --skip-errors for import and export, and --editor for edit. The delete action accepts --skip-errors but ignores it.
| Argument | Actions | Description |
|---|---|---|
-f,--file <arg> | import, edit, export, delete | For import, the path to a schema file to import, named Namespace.TableName.schema. For edit, export, and delete, a schema name in the form Namespace.TableName (or a namespace name, for delete --operate-on-namespace). Can be specified multiple times, except for edit. For export, cannot be combined with --namespace or --namespaceset. |
-d,--directory <arg> | import, export | For import, a directory from which the *.schema files in the directory and in its immediate subdirectories (not deeper) are imported; header.schema and footer.schema are ignored. For export, the directory to which schema files are written; if omitted, schemas are printed to stdout. |
-n,--namespace <arg> | import, export, list | Limit processing to this namespace. Can be specified multiple times. |
-s,--namespaceset <arg> | import, export, list | Limit processing to this namespace set: System or User. If omitted, both namespace sets are processed. |
--force | import, export, delete | For import, overwrite schemas that already exist. For export, overwrite existing files. For delete, required to actually delete; without it, the command only prints what would be deleted. |
-u,--update | import | Same as --force: overwrite schemas that already exist. |
-e,--skip-errors | import, export | For import: without this option, an error while parsing or validating any schema file stops the import before anything is imported. An error while adding or updating a schema in the schema service does not roll anything back: the remaining schemas are still imported and the command fails at the end, so the import can be partial. With this option, schemas without errors are imported and the rest are reported as warnings instead of failing the command. For export: only affects exports by explicit schema name, where schemas that fail to retrieve are skipped instead of aborting. |
-l,--lenient-validation | import, edit | Allow unknown classes and logger/listener compilation errors when validating. Classes used in a schema may not be available when reading the schema; this is a fatal error unless this option is specified. Setting SchemaXmlParser.disableValidation=true disables parser-level validation, but the schema is still parsed and structurally pre-validated. |
--compile | import, edit | Compile loggers and listeners while importing or editing a schema. This is the default. |
--no-compile | import, edit | Do not compile loggers and listeners while importing or editing a schema. This can be used to import or edit schemas with apparent errors. Use with care: if the Data Import Server cannot compile the listeners, data cannot be ingested. |
-o,--operate-on-namespace | list, delete | Operate on namespaces instead of schemas. |
-e,--editor <arg> | edit | The editor to use. Defaults to the EDITOR environment variable, or vi if that is not set. |
import
Note
Unless you use --etcd, import actions require authentication, with sudo, --key, or --user.
Deploy a (new) single schema:
Import a (new) single schema without compiling loggers/listeners and allowing selected validation errors (use with care):
This still parses and structurally validates the schema. --lenient-validation allows selected validation errors, and --no-compile skips logger/listener compilation.
Deploy a (new) single schema directly to etcd, bypassing the configuration server:
Re-deploy the ExampleNamespace schemas:
edit
Note
Unless you use --etcd, edit actions require authentication, with sudo, --key, or --user.
Open the current version of a single schema in an editor. After you save and exit, dhconfig asks whether to import the changed schema, then validates it with the same checks as import. If validation fails, you can edit again, show the full exception, or abort. The retry-while-ignoring choice does not relax schema validation; to relax it, restart the edit with --lenient-validation or --no-compile. See Editing configuration for more details.
Edit the schema for LearnDeephaven.StockQuotes:
Edit a schema with a specific editor:
export
Export all schemas in namespace DbInternal to /tmp/schemas:
Print a schema to stdout:
list
List all namespaces:
List all schemas in namespace DbInternal:
List all System schemas, bypassing configuration server (requires more file permissions):
delete
Note
Unless you use --etcd, delete actions require authentication, with sudo, --key, or --user.
Delete MyTable1 and MyTable2 from namespace MyNamespace:
Delete namespace MyNamespace. A namespace can only be deleted after all of its schemas have been deleted: