A DbSetup extension to import data from CSV/TSV files.
- Java 11+
testImplementation 'com.sciencesakura:dbsetup-csv:3.0.0'
testImplementation 'com.sciencesakura:dbsetup-csv-kt:3.0.0'
<dependency>
<groupId>com.sciencesakura</groupId>
<artifactId>dbsetup-csv</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sciencesakura</groupId>
<artifactId>dbsetup-csv-kt</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
import static com.sciencesakura.dbsetup.csv.Import.csv;
@BeforeEach
void setUp() {
var operations = sequenceOf(
truncate("my_table"),
// `testdata.csv` must be in classpath.
csv("testdata.csv").into("my_table").build());
var dbSetup = new DbSetup(destination, operations);
dbSetup.launch();
}
import com.sciencesakura.dbsetup.csv.csv
@BeforeEach
fun setUp() {
dbSetup(destination) {
// `testdata.csv` must be in classpath.
csv("testdata.csv") {
into("my_table")
}
}.launch()
}
See API reference for details.
MIT License
Copyright (c) 2019 sciencesakura