{"record":{"id":"3eb65d2db8e59d7a","repo":"apache/beam","slug":"creating-tables-is-not-supported-with-datacatalog-table","errorCode":null,"errorMessage":"Creating tables is not supported with DataCatalog table provider.","messagePattern":"Creating tables is not supported with DataCatalog table provider\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogTableProvider.java","lineNumber":93,"sourceCode":"    this.dataCatalog = dataCatalog;\n    this.tableFactory =\n        ChainedTableFactory.of(\n            PUBSUB_TABLE_FACTORY, GCS_TABLE_FACTORY, new BigQueryTableFactory(truncateTimestamps));\n  }\n\n  public static DataCatalogTableProvider create(DataCatalogPipelineOptions options) {\n    return new DataCatalogTableProvider(\n        createDataCatalogClient(options), options.getTruncateTimestamps());\n  }\n\n  @Override\n  public String getTableType() {\n    return \"google.cloud.datacatalog\";\n  }\n\n  @Override\n  public void createTable(Table table) {\n    throw new UnsupportedOperationException(\n        \"Creating tables is not supported with DataCatalog table provider.\");\n  }\n\n  @Override\n  public void dropTable(String tableName) {\n    throw new UnsupportedOperationException(\n        \"Dropping tables is not supported with DataCatalog table provider\");\n  }\n\n  @Override\n  public Map<String, Table> getTables() {\n    throw new UnsupportedOperationException(\"Loading all tables from DataCatalog is not supported\");\n  }\n\n  @Override\n  public @Nullable Table getTable(String tableName) {\n    return loadTable(tableName);\n  }","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogTableProvider.java#L75-L111","documentation":"The DataCatalog table provider is read-only: it resolves table metadata from Google Cloud DataCatalog but cannot register new tables. createTable() unconditionally throws UnsupportedOperationException. DDL like CREATE TABLE against this provider is rejected.","triggerScenarios":"Executing CREATE TABLE / BeamSql.createTable against a BeamSqlEnv configured with the datacatalog provider, or calling provider.createTable(table) directly.","commonSituations":"Running Beam SQL pipelines with `CREATE EXTERNAL TABLE ... TYPE google.cloud.datacatalog` or attempting to provision tables via this provider; users assume catalog providers can write back to the catalog.","solutions":["Pre-create the table in BigQuery and attach a schema in DataCatalog instead of creating it through Beam.","Use a writable provider (e.g. bigquery provider) for CREATE TABLE operations.","Remove the CREATE TABLE step; query the DataCatalog-registered table directly with SELECT."],"exampleFix":"// before\nString sql = \"CREATE EXTERNAL TABLE t (...) TYPE 'google.cloud.datacatalog'\";\n\n// after\n// register the table (with schema) in DataCatalog / BigQuery first, then:\nString sql = \"SELECT * FROM t\"; // resolved via datacatalog provider","handlingStrategy":"validation","validationCode":"if (\"google.cloud.datacatalog\".equals(provider.getTableType())) {\n  throw new IllegalStateException(\"createTable is not supported; pre-create the table in BigQuery/DataCatalog\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  provider.createTable(table);\n} catch (UnsupportedOperationException e) {\n  // create table in BigQuery/GCP APIs instead\n}","preventionTips":["Treat datacatalog as a read-only provider","Pre-create tables in BigQuery and attach the schema in DataCatalog before running SQL","Route CREATE TABLE DDL to writable providers like bigquery"],"tags":["apache-beam","datacatalog","sql","java"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}