Convert Assembly to Package
This page explains the conversion function in kdb Insights Enterprise Packaging using the CLI, as well as provides an example conversion.
The CLI provides a conversion function to help you migrate from assemblies to packages. The remote-convert
function takes an assembly file and creates a package with the same name. The package is stored in a directory next to the original assembly file.
This package can be managed through the command line interface (CLI) or the web interface once it is uploaded to a kdb Insights Enterprise deployment. Upon deployment, the package behaves identically to the assembly from which it was created. To convert the assembly to package, run the following command:
kxi pm convert --help
Usage: kxi pm convert [OPTIONS] ASSEMBLY_FILE
Convert V1/V2 assemblies into Packages with the server. Optionally keep the
package installed on the server.
╭─ Authentication option overrides ────────────────────────────────────────────╮
│ --hostname,--url TEXT Insights URL │
│ --realm TEXT Realm │
│ --client-id TEXT Client id │
│ --client-secret TEXT Client secret │
│ --auth-enabled/--auth-disabled Retrieve Bearer Token │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --install Additionally installs the resulting │
│ package on the server. │
│ --output-format -o [json|table] Output format for the list command │
│ --server-timeout TEXT Timeout for Insights server calls │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
Example conversion
The example below runs the conversion of an existing assembly that includes a database, tables, and a pipeline:
kxi pm convert asm.yaml && kxi package info asm
==PATH==
/Users/kx/packages/asm
==OBJECT==
Package
==Manifest==
name: asm
version: 0.0.1
databases:
asm-db:
dir: databases/asm-db
shards:
- asm-db-shard
tables:
- trade
- quote
- exchange
- instrument
pipelines:
sp-asm:
file: pipelines/sp-asm.yaml
router: router/router.yaml
deployment_config: deployment_config/deployment_config.yaml
Troubleshooting conversion
If the conversion fails, kdb Insights Enterprise indicates which fields are problematic.
To ensure a successful conversion, modify the existing assembly by fixing the required fields.
In the example below, the conversion requires the field compression to be added to the two tiers and the field "stream" to be removed from the Storage Manager. To resolve this, make sure to add these fields.
spec -> elements -> sm -> tiers -> 1 -> compression -> level field required (type=value_error.missing)
spec -> elements -> sm -> tiers -> 2 -> compression -> level field required (type=value_error.missing)
spec -> elements -> sm -> stream
extra fields not permitted (type=value_error.extra)