Skip to content

Commit

Permalink
Add a flush
Browse files Browse the repository at this point in the history
  • Loading branch information
samleeflang committed Jan 29, 2024
1 parent d73389f commit bb473b7
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void batchCopy(String tableName, List<Pair<String, JsonNode>> dbRecords)
for (var dbRecord : dbRecords) {
bos.write(getCsvRow(dbRecord));
}
try (ByteArrayInputStream bais =
new ByteArrayInputStream(baos.toByteArray())) {
bos.flush();
try (var bais = new ByteArrayInputStream(baos.toByteArray())) {
copyManager.copyIn("COPY " + tableName
+ " FROM stdin DELIMITER ','", bais);
}
Expand All @@ -59,5 +59,4 @@ public void batchCopy(String tableName, List<Pair<String, JsonNode>> dbRecords)
}
}


}

0 comments on commit bb473b7

Please sign in to comment.