Skip to main content
Version: 3.6.5

db Command

The db command synchronizes data to a SQL database.

Usage

 db sync <db-engine> --host <host> --port <port> --user <user> --password <password> --database <database>
--arg key=value --arg key2=value2
--complete-schema --drop-existing-tables --batch-size <batch-size>

Parameters

ParameterDescription
db-engineThe database engine to use.
Supported engines
postgresql
mariadb
mysql
sqlite
snowflake

Options

OptionDescription
--hostThe host of the database server
--portThe port of the database server
--userThe user to use for authentication
--passwordThe password to use for authentication
--databaseThe database to use
--argA key-value pair that will be passed to the connection driver. This property can be used multiple times
--batch-sizeThe number of rows that will be inserted in a single batch
--complete-schemaExport the entire schema, no matter which data gets exported
--drop-existing-tablesDrop all tables that are not part of the current export

Examples

Sync the complete graph to a sqlite database
 > db sync sqlite --database resoto.db --drop-existing
Sync the complete graph to a postgresql database
 > db sync postgresql --host localhost --port 5432 --database resoto --user ci --password bombproof
Sync the complete graph to a mariadb database
 > db sync mariadb --host localhost --port 3306 --user root --password pw --database test
Sync the complete graph to a mysql database
 > db sync mysql --host localhost --port 3306 --user root --password pw --database test
Sync the complete graph to a snowflake database
> db sync snowflake --host localhost --port 3306 --user root --password pw --database test
--arg warehouse=compute_wh --arg role=accountadmin
Select a subset of data and sync it to a sqlite database
 > search --with-edges is(graph_root) -[0:2]-> | db sync sqlite --database resoto.db
Sync all large instances into a sqlite database
 > search instance_cores > 8 | db sync sqlite --database large_instances.db
info

When you use search to filter the data that should be synced to the database, you can use the --with-edges option to include the dependencies between your resources. Resoto DataLink will then create corresponding link tables in the database. If you do not care about the resource dependencies, you can omit the --with-edges option.

Contact Us

Have feedback or need help? Don’t be shy—we’d love to hear from you!

 

 

 

Some Engineering Inc.