Table 'datameer_export_tmp_<id>' Record Size Exceeds Internal Limit of 65535 Bytes

Problem

During export into an external Netezza database from Datameer, an error is received. 

Error message

INFO [<timestamp>] [MrPlanRunnerV2] (JdbcConnector.java:351) - CREATE TABLE "ADMIN"."datameer_export_tmp_<id>" ("ID" int8 ,"URL" nvarchar(3000),"Column3" nvarchar(3000),"Column4" nvarchar(3000),...,"Column13" nvarchar(3000),"Column14" nvarchar(3000),PRIMARY KEY( "ID" ))
ERROR [<timestamp>] [MrPlanRunnerV2] (ClusterSession.java:186) - Failed to run cluster job 'Export job (<id>): Netezza_ExportJob#export(Disconnected record stream)#export(Disconnected record ' [0 sec]
java.lang.RuntimeException: ERROR:  Table 'datameer_export_tmp_<id>' record size 156008 exceeds internal limit of 65535 bytes
        at datameer.dap.sdk.util.ExceptionUtil.convertToRuntimeException(ExceptionUtil.java:49)
...
Caused by: org.netezza.error.NzSQLException: ERROR:  Table 'datameer_export_tmp_<id>' record size 156008 exceeds internal limit of 65535 bytes
        at org.netezza.internal.QueryExecutor.getNextResult(QueryExecutor.java:280)
        at org.netezza.internal.QueryExecutor.execute(QueryExecutor.java:76)
        at org.netezza.sql.NzConnection.execute(NzConnection.java:2750)
        at org.netezza.sql.NzStatement._execute(NzStatement.java:849)
        at org.netezza.sql.NzStatement._executeUpdate(NzStatement.java:860)
        at org.netezza.sql.NzStatement.executeUpdate(NzStatement.java:383)
        at datameer.dap.common.db.JdbcConnector.executeUpdate(JdbcConnector.java:353)
        at datameer.dap.common.db.JdbcConnector.createTable(JdbcConnector.java:457)
        at datameer.dap.common.job.dapexport.TableStrategy$1.initializeExport(TableStrategy.java:23)
        at datameer.dap.common.job.dapexport.JdbcOutputAdapter.initializeExport(JdbcOutputAdapter.java:104)
        ... 19 more
...

Cause

Netezza can't have rows of size greater than 65K. Sizing limitations can be found in the Netezza Database User Guide.

Background Information

There are 13 columns seen being created of type nvarchar(3000). Although the column is defined as nvarchar(3000), Netezza takes 4 bytes of storage per varchar. That is 3000*4=12k per column even though only 3000 characters are stored in the field. Following that logic, we have 13 columns * 12k each = 156,000, which is exactly the error we are seeing. 

Solution

First create the table and its rows in Netezza, then change the Datameer export to point to that table and either append or replace the rows in question.