pentaho/pentaho-kettle · error · KettleException

DynamicSQLRow.Exception.SQLFieldNameEmpty

Error message

DynamicSQLRow.Exception.SQLFieldNameEmpty

What it means

DynamicSQLRow.processRow, on the first processed row, checks that the step's 'SQL field name' setting is non-empty and throws this KettleException otherwise. The SQL field name identifies the input field whose value is used as the SQL statement, so the step cannot function without it.

Solutions

  1. Open the Dynamic SQL Row step dialog and set the 'SQL fieldname' to the input field containing the SQL text
  2. Ensure the upstream step actually produces that field
  3. Re-save the transformation so the setting persists
  4. Check the step's XML/repository record contains the sql_fieldname tag

Example fix

// before
<sql_fieldname></sql_fieldname>
// after
<sql_fieldname>sql_statement</sql_fieldname>
Defensive patterns

Strategy: validation

Validate before calling

// Before building/running the transformation:
if (meta.getSQLFieldName() == null || meta.getSQLFieldName().trim().isEmpty()) {
  throw new IllegalStateException("Dynamic SQL Row: SQL fieldname is not set");
}

Try / catch

try {
  // processRow will throw on first row
} catch (KettleException e) {
  logError("Configure the SQL fieldname in the Dynamic SQL Row step", e);
  stopAll(); setErrors(1);
  return false;
}

Prevention

When it happens

Trigger: Executing a transformation whose Dynamic SQL Row step has an empty 'SQL field name' setting — typically after a partial configuration or a loadXML that lost the sql_fieldname tag.

Common situations: Newly added step not yet configured; step XML/repository record missing 'sql_fieldname'; copy-paste of step metadata that dropped the field setting.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/437c24df3facb9d9. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/dynamicsqlrow/DynamicSQLRow.java:218

      if ( data.db != null ) {
        data.db.closeQuery( rs );
      }
    }

  }

  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
    meta = (DynamicSQLRowMeta) smi;
    data = (DynamicSQLRowData) sdi;

    Object[] r = getRow(); // Get row from input rowset & set row busy!
    if ( r == null ) { // no more input to be expected...
      setOutputDone();
      return false;
    }
    if ( first ) {
      if ( Utils.isEmpty( meta.getSQLFieldName() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "DynamicSQLRow.Exception.SQLFieldNameEmpty" ) );
      }

      if ( Utils.isEmpty( meta.getSql() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "DynamicSQLRow.Exception.SQLEmpty" ) );
      }

      // cache the position of the field
      if ( data.indexOfSQLField < 0 ) {
        data.indexOfSQLField = getInputRowMeta().indexOfValue( meta.getSQLFieldName() );
        if ( data.indexOfSQLField < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString( PKG, "DynamicSQLRow.Exception.FieldNotFound", meta
            .getSQLFieldName() ) );
        }
      }
    }
    try {
      lookupValues( getInputRowMeta(), r );

View on GitHub (pinned to f3058517a1)