This Spring Boot application is used to generate test data files and load data into the store_demo
database. The loader
application uses Spring profiles and profile specific application-{profile}.properties
files. The default active profile is production
. To use the local Docker instance start the loader
application with the following parameter -Dspring.profiles.active=docker
.
To generate data run the following command:
java -jar loader-2019.1-BETA.jar --generate
generate
accepts the following additional parameters:
crdb.generate.states
- a comma separated list of "states" to generate data for. These "states" should map to partitions which will in turn be used in zone constraints.crdb.generate.accts
- number of records to create for theacct
tablecrdb.generate.auths
- number of records to create for theauth
tablecrdb.generate.origin.state
- a state code where all initial cards belong
For example, this command would result in the creation of 2 files accts-1000.csv
and auths-100.csv
in the current directory. These files can be used for future load
or import
commands.
java -jar loader-2019.1-BETA.jar --generate --crdb.generate.states=SC,TX,CA --crdb.generate.accts=1000 --crdb.generate.auths=100
An alternative method for loading large amounts of data quickly can be used. To use this option run the following:
java -jar loader-2019.1-BETA.jar --import
import
accepts the following additional parameters:
crdb.import.accts.create.url
- url of sql file to createacct
tablecrdb.import.accts.data.url
- url of.csv
file to load intoacct
tablecrdb.import.auths.create.url
- url of sql file to createauth
tablecrdb.import.auths.data.url
- url of.csv
file to load intoauth
tablecrdb.server
- the ip address or hostname of a CockroachDB node
To generate
data files and immediately load
them into the database using batch statements you can run the following. This method works very well for testing and loading small data sets. For larger data sets, use the --import
option above.
java -jar loader-2019.1-BETA.jar --generate --load
load
accepts the following additional parameters:
crdb.load.accts.data.file
- path to.csv
for loadingacct
tablecrdb.load.auths.data.file
- path to.csv
for loadingauth
tablecrdb.server
- the ip address or hostname of a CockroachDB node