{"record":{"id":"71b7a292770ab605","repo":"pentaho/pentaho-kettle","slug":"getsqlprogressdialog-runtimeerror-unabletogeneratesql","errorCode":"GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception","errorMessage":"GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception","messagePattern":"GetSQLProgressDialog\\.RuntimeError\\.UnableToGenerateSQL\\.Exception","errorType":"exception","errorClass":"InvocationTargetException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/spoon/dialog/GetSQLProgressDialog.java","lineNumber":62,"sourceCode":"  /**\n   * Creates a new dialog that will handle the wait while getting the SQL for a transformation...\n   */\n  public GetSQLProgressDialog( Shell shell, TransMeta transMeta ) {\n    this.shell = shell;\n    this.transMeta = transMeta;\n  }\n\n  public List<SQLStatement> open() {\n    IRunnableWithProgress op = new IRunnableWithProgress() {\n      public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {\n        // This is running in a new process: copy some KettleVariables info\n        // LocalVariables.getInstance().createKettleVariables(Thread.currentThread(), parentThread, true);\n        // --> don't set variables if not running in different thread --> pmd.run(true,true, op);\n\n        try {\n          stats = transMeta.getSQLStatements( new ProgressMonitorAdapter( monitor ) );\n        } catch ( KettleException e ) {\n          throw new InvocationTargetException( e, BaseMessages.getString(\n            PKG, \"GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception\", e.getMessage() ) );\n        }\n      }\n    };\n\n    try {\n      ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );\n      pmd.run( false, false, op );\n    } catch ( InvocationTargetException e ) {\n      new ErrorDialog( shell, BaseMessages.getString( PKG, \"GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Title\" ),\n        BaseMessages.getString( PKG, \"GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Message\" ), e );\n      stats = null;\n    } catch ( InterruptedException e ) {\n      new ErrorDialog( shell, BaseMessages.getString( PKG, \"GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Title\" ),\n        BaseMessages.getString( PKG, \"GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Message\" ), e );\n      stats = null;\n    }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/spoon/dialog/GetSQLProgressDialog.java#L44-L80","documentation":"GetSQLProgressDialog runs transMeta.getSQLStatements(monitor) on a background thread to build schema-creation SQL for a transformation. Any KettleException is wrapped in an InvocationTargetException with localized message GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception.","triggerScenarios":"Clicking the SQL button in Spoon for a transformation where step SQL generation fails: invalid or empty table names, missing database connections on table-output steps, or unsupported database features.","commonSituations":"Target database dialect unsupported by a step; table-output steps with empty table names; steps referencing removed database connections.","solutions":["Read the wrapped KettleException message to identify the failing step.","Verify each step's database connection and target table settings.","Select a supported database dialect for all steps before generating SQL.","Run transformation verification first to catch metadata problems."],"exampleFix":"// before\nTableOutputMeta out = ...; out.setTableName(\"\"); // empty table name breaks SQL generation\n// after\nout.setTableName( \"target_table\" ); out.setDatabaseMeta( dbMeta );","handlingStrategy":"validation","validationCode":"for (StepMeta step : transMeta.getSteps()) {\n  if (step.getStepMetaInterface() instanceof TableOutputMeta\n      && ((TableOutputMeta) step.getStepMetaInterface()).getTableName().isEmpty()) {\n    throw new IllegalStateException(\"TableOutput step '\" + step.getName() + \"' has no target table\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  new GetSQLProgressDialog(shell, transMeta, onlySelected).open();\n} catch (Exception e) {\n  log.error(\"SQL generation failed: \", e);\n}","preventionTips":["Assign valid connections and table names to all steps.","Confirm all steps support the target database dialect.","Run transformation verification before generating SQL."],"tags":["pdi","sql-generation","progress-dialog","transmeta"],"backgroundTag":"sql-query-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}