Upload a Package
This page provides information on how to upload packages on kdb Insights Enterprise using the CLI.
Prerequisite
- Authenticate to your chosen kdb Insights Enterprise using the Command Line Interface.
Updating version before pushing
If you are developing a package and want to push up different versions as you iterate, you can use the checkpoint
command as follows:
kxi package checkpoint --help
Usage: kxi package checkpoint [OPTIONS] SOURCE
Create a package artifact given a source code directory.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --version TEXT Override the version of the │
│ package. │
│ --bump [major|minor|patch|dev] Increment the │
│ major/minor/patch/dev version. │
│ --version-info TEXT Leave a description note for the │
│ checkpoint version. │
│ --package-name TEXT Override the auto-generated │
│ package name. │
│ --kxi TEXT Create a kxi artifact after │
│ checkpointing in a target │
│ directory. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
Running your command with --bump
multiple times updates the package's version intuitively. For example:
kxi package checkpoint test-package --bump minor
Packed package: test-package-0.1.0.kxi
kxi package checkpoint test-package --bump minor
Packed package: test-package-0.2.0.kxi
Once you've modified your package and bumped the version you can push
it.
Upload package
Run the push
command to upload the package to your desired kdb Insights Enterprise deployment. After that, you can view and deploy it, as well as use the functions defined in the package in the web interface or using the CLI.
kxi pm push test-package
Run the --help
command to learn more about the push options available, as follows:
kxi pm push --help
Usage: kxi pm push [OPTIONS] [PATH]
Publish a package to kdb+ Insights Enterprise Package Manager service.
╭─ 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 ────────────────────────────────────────────────────────────────────╮
│ --deploy Deploy the package after pushing. │
│ --force Force push: overwrite existing packages │
│ --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. │
╰──────────────────────────────────────────────────────────────────────────────╯
When you push
a package, it doesn't deploy immediately.
You are able to view and manage it on kdb Insights Enterprise through the web interface or the CLI. To run the package, you need to deploy it using the CLI or the web interface.
Packages uploaded to kdb Insights Enterprise must have a unique name. If you attempt to upload a version of a package that already exists on your kdb Insights Enterprise installation, the installation is skipped and a conflict
error is returned, as shown below:
kxi pm push test-package
Client error '409 Conflict' for url 'https://pakx-dev.aws-purple.kxi-dev.kx.com/packagemanager/v2/packages?version=&relationships=&force=false'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409
ERROR Conflict - Package(name=test-package, version=0.0.1) already exists.
If you want to upload a package and need to overwrite an existing package, you can use the --force
option as follows:
kxi pm push test-package
Push with Package(name=test-package, version=0.0.1) and force=False
╭──────────────┬─────────┬────────┬────────────────────────────────┬──────────────────────────────────────╮
│ name │ version │ access │ owner.name │ id │
├──────────────┼─────────┼────────┼────────────────────────────────┼──────────────────────────────────────┤
│ test-package │ 0.0.1 │ ARWX │ service-account-test-publisher │ add333ad-bdd2-41a9-bcc7-a24fdbee598f │
╰──────────────┴─────────┴────────┴────────────────────────────────┴──────────────────────────────────────╯
Locking q code before you push
The kxi package lock
command can be used to Lock code