diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5289f034..e8e82f35 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -28,5 +28,8 @@ jobs:
- name: Running Kafka
run: docker-compose -f docker/compose/kafka-schema-registry.yml up -d && sleep 10
+ - name: Running PostgreSQL (to test DB SQL Executor)
+ run: docker-compose -f docker/compose/pg_compose.yml up -d
+
- name: Building and testing the changes
run: mvn clean test
diff --git a/core/pom.xml b/core/pom.xml
index f59e00aa..7fb25c0b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -175,11 +175,20 @@
micro-simulator
test
+
+ commons-dbutils
+ commons-dbutils
+
com.h2database
h2
test
+
+ org.postgresql
+ postgresql
+
+
com.aventstack
extentreports
diff --git a/core/src/main/java/org/jsmart/zerocode/core/db/DbCsvLoader.java b/core/src/main/java/org/jsmart/zerocode/core/db/DbCsvLoader.java
new file mode 100644
index 00000000..877f4469
--- /dev/null
+++ b/core/src/main/java/org/jsmart/zerocode/core/db/DbCsvLoader.java
@@ -0,0 +1,135 @@
+package org.jsmart.zerocode.core.db;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import org.apache.commons.dbutils.QueryRunner;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.univocity.parsers.csv.CsvParser;
+
+/**
+ * Data loading in the database from a CSV external source
+ */
+class DbCsvLoader {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DbCsvLoader.class);
+ private Connection conn;
+ private CsvParser csvParser;
+
+ public DbCsvLoader(Connection conn, CsvParser csvParser) {
+ this.conn = conn;
+ this.csvParser = csvParser;
+ }
+
+ /**
+ * Loads rows in CSV format (csvLines) into a table in the database
+ * and returns the total number of rows.
+ */
+ public int loadCsv(String table, List csvLines, boolean withHeaders, String nullString) throws SQLException {
+ if (csvLines == null || csvLines.isEmpty())
+ return 0;
+
+ List lines = parseLines(table, csvLines);
+
+ String[] headers = buildHeaders(lines.get(0), withHeaders);
+ List
+
+ commons-dbutils
+ commons-dbutils
+ ${commons-dbutils.version}
+
com.h2database
h2
${h2.db.version}
test
+
+ org.postgresql
+ postgresql
+ ${postgres.db.version}
+
com.aventstack
extentreports