apache/beam · error · ValueError
TableFunctionQueryConfig must provide table_id and…
Error message
TableFunctionQueryConfig must provide table_id and where_clause_template
What it means
TableFunctionQueryConfig.__post_init__ requires table_id and where_clause_template; missing or empty values raise ValueError. This config combines a table with a custom condition-value function, so both the table name and the SQL template are mandatory.
Solutions
- Supply non-empty table_id and where_clause_template strings
- Check the code path that builds the config for accidental None assignment
- Use CustomQueryConfig for full control instead of table+template
Example fix
// before TableFunctionQueryConfig(table_id='', where_clause_template='', where_clause_value_fn=fn) // after TableFunctionQueryConfig(table_id='orders', where_clause_template='WHERE order_id = :order_id', where_clause_value_fn=fn)
Defensive patterns
Strategy: validation
Validate before calling
def make_table_fn_config(table_id, tmpl, fn):
if not table_id or not tmpl:
raise ValueError('table_id and where_clause_template required')
if not callable(fn):
raise ValueError('where_clause_value_fn must be callable')
return TableFunctionQueryConfig(table_id, tmpl, fn) Try / catch
try:
cfg = TableFunctionQueryConfig(**raw)
except ValueError as e:
raise ValueError(f'invalid TableFunctionQueryConfig: {e}') from e Prevention
- Don't migrate between config variants by copy-paste; list required fields explicitly
- Fail fast on empty template strings from config files
- Test config construction in CI
When it happens
Trigger: TableFunctionQueryConfig(table_id=None/'' or where_clause_template=None/'', where_clause_value_fn=fn).
Common situations: Migrating from TableFieldsQueryConfig and dropping required fields; template strings loaded from config that resolve to empty.
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
- CustomQueryConfig must provide a valid query_fn
- TableFieldsQueryConfig must provide non-empty…
- TableFieldsQueryConfig must provide table_id and…
- TableFunctionQueryConfig must provide where_clause_value_fn
- An unsupported sink was specified
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/eb59f2954fd56c92.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql.py:83
"TableFieldsQueryConfig must provide table_id and " +
"where_clause_template")
if not self.where_clause_fields:
raise ValueError(
"TableFieldsQueryConfig must provide non-empty " +
"where_clause_fields")
@dataclass
class TableFunctionQueryConfig:
"""Configuration for using table name, where clause, and a value function."""
table_id: str
where_clause_template: str
where_clause_value_fn: ConditionValueFn
def __post_init__(self):
if not self.table_id or not self.where_clause_template:
raise ValueError(
"TableFunctionQueryConfig must provide table_id and " +
"where_clause_template")
if not self.where_clause_value_fn:
raise ValueError(
"TableFunctionQueryConfig must provide " + "where_clause_value_fn")
class DatabaseTypeAdapter(Enum):
POSTGRESQL = "pg8000"
MYSQL = "pymysql"
SQLSERVER = "pytds"
def to_sqlalchemy_dialect(self):
"""Map the adapter type to its corresponding SQLAlchemy dialect.
Returns:
str: SQLAlchemy dialect string.View on GitHub (pinned to 12126d8942)