Importing existing Data into Chronicle
Importing Data into Chronicle
Chronicle provides a CLI command import
to load data from a JSON-LD file that
contains an array of Chronicle Operations. These operations can be used to
create agents, namespaces, and other resources in the Chronicle database. For
more information about the data format of the import file, see Recording Provenance.
Example import process
Local development environment
To import data into Chronicle, follow these steps:
- Create a JSON-LD file with an array of Chronicle Operations.
- Save the file in the Chronicle root directory with a unique name, for example,
import.json
. - Run the following command:
See the CLI import
command help
for more information on each argument in the command.
If the data is successfully imported, the Chronicle Operations will be added to the Chronicle database.
Docker compose environment
Note: This example assumes you are using the chronicle-examples and running the stl version of the docker compose file. You will need to adapt the instructions to your environment, specifically the name of the chronicle container.
To import data into Chronicle, follow these steps:
- Create a JSON-LD file with an array of Chronicle Operations.
- Add a bind mount to your docker compose file mounting your file in the
chronicle container. If you're using the chronicle-examples
or chronicle-bootstrap
configuration then this will be for the
chronicle-sawtooth-api
container, as defined indocker/chronicle.yaml
.
Note: You will need to adapt the instructions to your environment, specifically the path to your import source file. The following example assumes that you are using the chronicle-examples repository and that your import file is in the root directory of the repository.
- Start your docker compose environment
- Exec into the chronicle container
- Run the following command:
chronicle -c /etc/chronicle/config/config.toml \
--console-logging pretty \
--sawtooth tcp://validator:4004 \
import <namespace-id> <namespace-uuid> file:///import.json
See the CLI import
command help
for more information on each argument in the command.
If the data is successfully imported, the Chronicle Operations will be added to the Chronicle database.