Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export / Import #29

Merged
merged 7 commits into from
Sep 29, 2023
Merged

Export / Import #29

merged 7 commits into from
Sep 29, 2023

Conversation

lferran
Copy link
Contributor

@lferran lferran commented Sep 28, 2023

Example usage via the CLI

# Export a kb
$ nuclia kbs my-source-kb default
$ nuclia kb exports start --path=$HOME/foobar
Export is ready to be downloaded.
Downloading export 8be5339818f443f8b6c0afc143d2fe02 to /Users/ferran/foobar: 7.13MB [00:05, 1.36MB/s]

# Import it to another kb
$ nuclia kbs my-dst-kb default
$ nuclia kb imports start --path=$HOME/foobar
Uploading from /Users/ferran/foobar to import: 7.13MB [00:01, 3.77MB/s]
import_id='317e6816a661450e91ba192afad96b99'
$ nuclia kb imports status --import_id=317e6816a661450e91ba192afad96b99
status=<Status.FINISHED: 'finished'>

# Alternately, start import and use --sync to wait for it to finish
$ nuclia kb imports start --path=$HOME/foobar --sync

Example usage with python

from nuclia import sdk

exports = sdk.NucliaExports()
export_id = exports.start().export_id
assert exports.status(export_id=export_id).value == "finished"
exports.download(export_id=export_id, path="/some/path/kb.export")

imports = sdk.NucliaImports()
import_id = imports.start(path="/some/path/kb.export").import_id
assert imports.status(import_id=import_id).status == "finished"

imports.start(path="/some/path/kb.export", sync=True)

Copy link
Collaborator

@ebrehault ebrehault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I experienced a bug when doing the export (see on Discord)
  • I have added docs

Implementation looks good to me.

@lferran lferran merged commit fd6e90c into main Sep 29, 2023
2 checks passed
@lferran lferran deleted the export-import branch September 29, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants