apache/seatunnel · error · DatabendConnectorException
SQL_OPERATION_FAILED
SQL_OPERATION_FAILED
Error message
Either SQL, query, or both database and table must be specified
What it means
DatabendSourceFactory.buildSqlStatement constructs the source query from the user's options. The user must provide sql, or query, or both database and table. When none of these resolve to a statement, DatabendConnectorException(SQL_OPERATION_FAILED) is thrown because the connector has nothing to read.
Source
Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/source/DatabendSourceFactory.java:144
/** according to the options, build the SQL statement */
private String buildSqlStatement(ReadonlyConfig options) {
if (options.getOptional(DatabendSourceOptions.SQL).isPresent()) {
return options.get(DatabendSourceOptions.SQL);
}
String query = options.getOptional(DatabendOptions.QUERY).orElse(null);
if (query != null) {
return query;
}
String database = options.getOptional(DATABASE).orElse(null);
String table = options.getOptional(DatabendOptions.TABLE).orElse(null);
if (database != null && table != null) {
return String.format("SELECT * FROM %s.%s", database, table);
}
throw new DatabendConnectorException(
DatabendConnectorErrorCode.SQL_OPERATION_FAILED,
"Either SQL, query, or both database and table must be specified");
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Add both database and table options to the Databend source config.
- Or provide a full sql (or query) option instead of database/table.
- Check for typos in option keys against DatabendOptions (SQL, QUERY, DATABASE, TABLE).
- Validate the config file renders non-empty values (no unresolved placeholders/variables).
Example fix
// before
source {
Databend {
url = "jdbc:databend://localhost:8000"
}
}
// after
source {
Databend {
url = "jdbc:databend://localhost:8000"
database = "mydb"
table = "my_table"
}
} Defensive patterns
Strategy: validation
Validate before calling
// validate source options before job submission
boolean hasSql = sql != null && !sql.isEmpty();
boolean hasQuery = query != null && !query.isEmpty();
boolean hasDbTable = database != null && !database.isEmpty()
&& table != null && !table.isEmpty();
if (!hasSql && !hasQuery && !hasDbTable) {
throw new IllegalArgumentException("Provide sql, query, or database+table for Databend source");
} Try / catch
try {
sourceFactory.createSource(options);
} catch (DatabendConnectorException e) {
if (e.getMessage().contains("Either SQL, query, or both database and table")) {
log.error("Databend source config incomplete: set database+table or sql/query");
} else throw e;
} Prevention
- Always set database and table (or a full sql/query) in the source config
- Check option key spelling against DatabendOptions constants
- Avoid empty-string values that bypass null checks
- Lint generated configs for unresolved placeholders before submission
When it happens
Trigger: Source options omit all three: no sql, no query, and at least one of database/table is missing or null; option keys misspelled so getOptional returns empty.
Common situations: Hand-written HOCON config missing the table option; typo like databse/table_name; copying a template and deleting placeholder values; dynamically generated configs where an empty string was passed (note: empty string may still pass null checks — supply real values).
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- The source table[%s] is not found
- Option 'field_delimiter' cannot be empty
- Option 'batch_size' must be between 1 and 32
- Option 'visibility_timeout_seconds' must be between 1 and 60
- Option 'poll_interval_ms' must be greater than zero
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1ca6f61dab5e6279.
Report an issue: GitHub.