{"record":{"id":"630168675e1a4a72","repo":"apache/beam","slug":"s-table-must-be-of-type-string-got-valueprovider-instead","errorCode":null,"errorMessage":"%s: table must be of type string; got ValueProvider instead","messagePattern":"(.+?): table must be of type string; got ValueProvider instead","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery.py","lineNumber":3119,"sourceCode":"          'The method to read from BigQuery must be either EXPORT '\n          'or DIRECT_READ.')\n    return self._expand_output_type(output_pcollection)\n\n  def _expand_output_type(self, output_pcollection):\n    if self.output_type == 'PYTHON_DICT' or self.output_type is None:\n      return output_pcollection\n    elif self.output_type == 'BEAM_ROW':\n      if self._kwargs.get('query', None) is not None:\n        user_schema = bigquery_tools.get_dict_table_schema(\n            self.query_output_schema)\n        return output_pcollection | bigquery_schema_tools.convert_to_usertype(\n            user_schema, self._kwargs.get('selected_fields', None))\n      table_details = bigquery_tools.parse_table_reference(\n          table=self._kwargs.get(\"table\", None),\n          dataset=self._kwargs.get(\"dataset\", None),\n          project=self._kwargs.get(\"project\", None))\n      if isinstance(self._kwargs['table'], ValueProvider):\n        raise TypeError(\n            '%s: table must be of type string'\n            '; got ValueProvider instead' % self.__class__.__name__)\n      elif callable(self._kwargs['table']):\n        raise TypeError(\n            '%s: table must be of type string'\n            '; got a callable instead' % self.__class__.__name__)\n      return output_pcollection | bigquery_schema_tools.convert_to_usertype(\n          bigquery_tools.BigQueryWrapper().get_table(\n              project_id=table_details.projectId,\n              dataset_id=table_details.datasetId,\n              table_id=table_details.tableId).schema,\n          self._kwargs.get('selected_fields', None))\n    else:\n      raise ValueError(\n          'The output type from BigQuery must be either PYTHON_DICT '\n          'or BEAM_ROW.')\n\n  def _expand_export(self, pcoll):","sourceCodeStart":3101,"sourceCodeEnd":3137,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery.py#L3101-L3137","documentation":"ValidateDataflow.create/validate in bigquery.py raises ValueError when both a table and a query are supplied, because BigQuery reads in EXPORT mode must originate from exactly one source — a table export or a query result — and the two are mutually exclusive.","triggerScenarios":"ReadFromBigQuery(table='proj:ds.tbl', query='SELECT ...') — the internal validate() at bigquery.py:3253 fires when both self.table and self.query are non-None.","commonSituations":"Switching a pipeline from table reads to query reads and forgetting to remove the table argument; config files where both keys are populated; copy-pasted examples merged together.","solutions":["Remove the table argument and keep only query","Remove the query argument and keep only table","If the intent was to read a query over a table, express the table inside the query's FROM clause only"],"exampleFix":"// before\nReadFromBigQuery(table='proj:ds.tbl', query='SELECT * FROM proj.ds.tbl')\n// after\nReadFromBigQuery(query='SELECT * FROM proj.ds.tbl')","handlingStrategy":"validation","validationCode":"if isinstance(table, ValueProvider) and output_type == 'BEAM_ROW':\n    raise ValueError('BEAM_ROW requires a static string table')","typeGuard":"def supports_beam_row(table):\n    return isinstance(table, str)","tryCatchPattern":"try:\n    t = ReadFromBigQuery(table=table, output_type='BEAM_ROW')\nexcept TypeError as e:\n    if 'ValueProvider' in str(e):\n        t = ReadFromBigQuery(table=table, output_type='PYTHON_DICT')","preventionTips":["Use BEAM_ROW only with static tables","Default templated pipelines to PYTHON_DICT","Resolve table names from options before building the pipeline when possible"],"tags":["python","apache-beam","bigquery","conflicting-arguments"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}