apache/beam · error · ValueError
Columns are required with the table name.
Error message
Columns are required with the table name.
What it means
SpannerIO's read connector allows specifying just a table name for convenience, but a table read without a column list has no defined projection, so __init__ raises ValueError requiring columns whenever table is given (and no explicit read_operations were supplied).
Solutions
- Provide the columns list alongside table: spannerio.Read(..., table='Users', columns=['id', 'name']).
- Alternatively pass sql='SELECT * FROM Users' instead of table.
- Or construct read_operations explicitly with ReadOperation.table(..., columns=[...]) and pass that.
- Make columns a required pipeline option when the table option is set.
Example fix
// before
read = spannerio.Read(project_id, instance_id, database_id, table='Users')
// after
read = spannerio.Read(project_id, instance_id, database_id,
table='Users', columns=['id', 'name', 'email']) Defensive patterns
Strategy: validation
Validate before calling
if table is not None and not columns:
raise ValueError('columns is required when reading by table name') Try / catch
try:
read = spannerio.Read(project_id, instance_id, database_id, table=table, columns=columns)
except ValueError as e:
if 'Columns are required' in str(e):
raise RuntimeError(f'Specify columns for table {table!r}') from e
raise Prevention
- Treat table and columns as a paired configuration
- Prefer sql='SELECT * FROM table' if you truly want all columns
- Make columns a required pipeline option whenever table is set
When it happens
Trigger: Calling spannerio.Read(project_id, instance_id, database_id, table='Users') without columns, when read_operations is None; also passing table with sql or omitting columns in kwargs.
Common situations: Developers expect SELECT * semantics and pass only a table name; code refactors drop the columns list; config-driven pipelines read a table name from options but forget the columns option.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Spanner required read operation, sql or table with columns.
- A BigQuery table or a query must be specified
- A function must be provided to convert the input type into…
- A has been supplied to the model handler, but the required…
- artifact_location is not specified. Please specify the…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/b5b2eae9986ea7db.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/io/gcp/experimental/spannerio.py:755
"""
self._configuration = _BeamSpannerConfiguration(
project=project_id,
instance=instance_id,
database=database_id,
table=table,
query_name=query_name,
credentials=credentials,
pool=pool,
snapshot_read_timestamp=read_timestamp,
snapshot_exact_staleness=exact_staleness)
self._read_operations = read_operations
self._transaction = transaction
if self._read_operations is None:
if table is not None:
if columns is None:
raise ValueError("Columns are required with the table name.")
self._read_operations = [
ReadOperation.table(
table=table, columns=columns, index=index, keyset=keyset)
]
elif sql is not None:
self._read_operations = [
ReadOperation.query(
sql=sql, params=params, param_types=param_types)
]
def expand(self, pbegin):
if self._read_operations is not None and isinstance(pbegin, PBegin):
pcoll = pbegin.pipeline | Create(self._read_operations)
elif not isinstance(pbegin, PBegin):
if self._read_operations is not None:
raise ValueError(
"Read operation in the constructor only works with "
"the root of the pipeline.")View on GitHub (pinned to 12126d8942)