Class PostgreSQLDatabaseAdapter
java.lang.Object
org.apache.nifi.processors.standard.db.impl.GenericDatabaseAdapter
org.apache.nifi.processors.standard.db.impl.PostgreSQLDatabaseAdapter
- All Implemented Interfaces:
DatabaseAdapter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlterTableStatement(String tableName, List<ColumnDescription> columnsToAdd) getAutoCommitForReads(Integer fetchSize) Get the auto commit mode to use for reading from this database type.getInsertIgnoreStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames) Returns an SQL INSERT_IGNORE statement - i.e.getName()getSQLForDataType(int sqlType) getUpsertStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames) Returns an SQL UPSERT statement - i.e.booleanbooleanTells whether this adapter supports INSERT_IGNORE.booleanTells whether this adapter supports UPSERT.Methods inherited from class org.apache.nifi.processors.standard.db.impl.GenericDatabaseAdapter
getSelectStatement, getSelectStatementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.nifi.processors.standard.db.DatabaseAdapter
generateTableName, getCreateTableStatement, getTableAliasClause
-
Constructor Details
-
PostgreSQLDatabaseAdapter
public PostgreSQLDatabaseAdapter()
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceDatabaseAdapter- Overrides:
getNamein classGenericDatabaseAdapter
-
getDescription
- Specified by:
getDescriptionin interfaceDatabaseAdapter- Overrides:
getDescriptionin classGenericDatabaseAdapter
-
supportsUpsert
public boolean supportsUpsert()Description copied from interface:DatabaseAdapterTells whether this adapter supports UPSERT.- Returns:
- true if UPSERT is supported, false otherwise
-
supportsInsertIgnore
public boolean supportsInsertIgnore()Description copied from interface:DatabaseAdapterTells whether this adapter supports INSERT_IGNORE.- Returns:
- true if INSERT_IGNORE is supported, false otherwise
-
getUpsertStatement
public String getUpsertStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames) Description copied from interface:DatabaseAdapterReturns an SQL UPSERT statement - i.e. UPDATE record or INSERT if id doesn't exist.
There is no standard way of doing this so not all adapters support it - use together withDatabaseAdapter.supportsUpsert()!- Parameters:
table- The name of the table in which to update/insert a record into.columnNames- The name of the columns in the table to add values to.uniqueKeyColumnNames- The name of the columns that form a unique key.- Returns:
- A String containing the parameterized jdbc SQL statement. The order and number of parameters are the same as that of the provided column list.
-
getInsertIgnoreStatement
public String getInsertIgnoreStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames) Description copied from interface:DatabaseAdapterReturns an SQL INSERT_IGNORE statement - i.e. Ignore record or INSERT if id doesn't exist.
There is no standard way of doing this so not all adapters support it - use together withDatabaseAdapter.supportsInsertIgnore()!- Parameters:
table- The name of the table in which to ignore/insert a record into.columnNames- The name of the columns in the table to add values to.uniqueKeyColumnNames- The name of the columns that form a unique key.- Returns:
- A String containing the parameterized jdbc SQL statement. The order and number of parameters are the same as that of the provided column list.
-
supportsCreateTableIfNotExists
public boolean supportsCreateTableIfNotExists() -
getAlterTableStatement
-
getAutoCommitForReads
Get the auto commit mode to use for reading from this database type. For PostgreSQL databases, auto commit mode must be set to false to cause a fetchSize other than 0 to take effect. More Details of this behaviour in PostgreSQL driver can be found in https://jdbc.postgresql.org//documentation/head/query.html.") For PostgreSQL, if autocommit is TRUE, then fetch size is treated as 0 which loads all rows of the result set to memory at once.- Parameters:
fetchSize- The number of rows to retrieve at a time. Value of 0 means retrieve all rows at once.- Returns:
- Optional.empty() if auto commit mode does not matter and can be left as is. Return true or false to indicate whether auto commit needs to be true or false for this database.
-
getSQLForDataType
-