Skip to content

Download a Package

This page provides an overview on how to download a package in kdb Insights Enterprise using the CLI.

You can pull packages from kdb Insights Enterprise to your local machine using the pull command.

kxi pm pull --help
 Usage: kxi pm pull [OPTIONS] NAME [VERSION]                                    

 Download a package from 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 ────────────────────────────────────────────────────────────────────╮
│ --output          -O  TEXT          Specify the output directory/archive     │
│                                     name for the downloaded package.         │
│                                     Defaults to package-name or              │
│                                     packagename-version.kxi                  │
│ --artifact        -A                Download the package into a compressed   │
│                                     archive.                                 │
│ --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.              │
╰──────────────────────────────────────────────────────────────────────────────╯

This command downloads the package to your current working directory into a folder with the package name.

kxi pm pull test_pkg 0.0.1
Pull with 'test-package', None
╭──────────────┬───────────────────────────────────────────────────────╮
│ name          status                                                │
├──────────────┼───────────────────────────────────────────────────────┤
│ test-package  Saved to /Users/user1/test-package                    │
│ -             -                                                     │
╰──────────────┴───────────────────────────────────────────────────────╯
Pull with 'test-package', None
╭──────────────┬─────────┬────────┬────────────────────────────────┬──────────────────────────────────────╮
│ name          version  access  owner.name                      id                                   │
├──────────────┼─────────┼────────┼────────────────────────────────┼──────────────────────────────────────┤
│ test-package  0.0.1    ARWX    service-account-test-publisher  add333ad-bdd2-41a9-bcc7-a24fdbee598f │
╰──────────────┴─────────┴────────┴────────────────────────────────┴──────────────────────────────────────╯

You can then see the structure of the output package:

tree  /Users/user1/test-package
test-package
├── databases
│   └── test-package
│       ├── shards
│          └── test-package-shard.yaml
│       └── tables
│           └── mytable.yaml
├── init.q
├── manifest.yaml
├── pipelines
│   └── pipeline.yaml
└── tables
    └── mytable.yaml

Pulling the Artifact

If you want to download the package as a single compressed .kxi file, run the following command:

kxi pm pull test-package -A

This can be very useful in conjunction with the unpack command below to open up and validate the contents of the package.

kxi package unpack test-package-0.0.1.kxi

The new directory structure is found in the current directory alongside the .kxi package file: test-package/.

To learn more about kxi artifacts see: Packing a package

Tidy up

After pulling a package, it can be beneficial to either delete the package. Doing this ensures that the package is properly set up and recognized before you run any kxi package commands, which are used to build a package.

Next steps