public class PostgreSqlUpsertWriter extends PostgreSqlInsertWriter
DataEndpoint.StatebatchedInserts, batchSize, pretty, tableNamecurrentRecordlastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
PostgreSqlUpsertWriter(String table,
File file,
boolean append,
List<String> keyFieldNames) |
PostgreSqlUpsertWriter(String table,
File file,
boolean append,
String... keyFieldNames) |
PostgreSqlUpsertWriter(String table,
File file,
List<String> keyFieldNames) |
PostgreSqlUpsertWriter(String table,
File file,
String... keyFieldNames) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Indicates that this endpoint has finished reading or writing.
|
ConflictAction |
getConflictAction() |
List<String> |
getKeyFieldNames() |
PostgreSqlUpsertWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch upserts.
|
PostgreSqlUpsertWriter |
setConflictAction(ConflictAction conflictAction)
Indicates the action to perform on conflict (default ConflictAction.UPDATE).
|
PostgreSqlUpsertWriter |
setPretty(boolean pretty)
Indicates if line breaks and indentations should be added to output upsert statement (default false).
Example output (pretty = true): INSERT INTO "tableName" ("col1", "col2", "col3") |
protected void |
writeRecord(Record record) |
addExceptionProperties, getBatchSize, getSqlValueLiteral, getTableName, isBatchMode, isPretty, setFieldNamesInFirstRowgetFile, getWriter, isAppend, isAutoCloseWriter, isFieldNamesInFirstRow, isFlushOnWrite, setAutoCloseWriter, setFlushOnWrite, writeopen, writeImplavailable, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriterdecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionpublic PostgreSqlUpsertWriter(String table, File file, boolean append, String... keyFieldNames)
public PostgreSqlUpsertWriter(String table, File file, boolean append, List<String> keyFieldNames)
public PostgreSqlUpsertWriter(String table, File file, String... keyFieldNames)
protected void writeRecord(Record record) throws Throwable
writeRecord in class PostgreSqlInsertWriterThrowablepublic void close()
DataEndpointclose in class PostgreSqlInsertWriterpublic PostgreSqlUpsertWriter setPretty(boolean pretty)
INSERT INTO "tableName" ("col1", "col2", "col3")
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3)
ON CONFLICT ("id") DO UPDATE SET "col1" = EXCLUDED."col1", "col2" = EXCLUDED."col2", "col3" = EXCLUDED."col3";
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3), (val1, val2, val3), (val1, val2, val3) ON CONFLICT ("id") DO UPDATE SET "col1" = EXCLUDED."col1", "col2" = EXCLUDED."col2", "col3" = EXCLUDED."col3";setPretty in class PostgreSqlInsertWriterpublic PostgreSqlUpsertWriter setBatchSize(int batchSize)
INSERT INTO "tableName" ("col1", "col2", "col3")
VALUES (val1, val2, val3),
(val1, val2, val3),
ON CONFLICT ("id") DO UPDATE SET "col1" = EXCLUDED."col1", "col2" = EXCLUDED."col2", "col3" = EXCLUDED."col3";
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3) ON CONFLICT ("id") DO UPDATE SET "col1" = EXCLUDED."col1", "col2" = EXCLUDED."col2", "col3" = EXCLUDED."col3";INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3) ON CONFLICT ("id") DO UPDATE SET "col1" = EXCLUDED."col1", "col2" = EXCLUDED."col2", "col3" = EXCLUDED."col3";setBatchSize in class PostgreSqlInsertWriterpublic ConflictAction getConflictAction()
public PostgreSqlUpsertWriter setConflictAction(ConflictAction conflictAction)
Copyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.