{"title":"R2 Data Catalog","description":"Connect Cloudflare R2 Data Catalog to Altertable as an Iceberg REST catalog for open, governed lakehouse analytics.","order":310,"askSuggestions":["Which permissions does the R2 token need?","Why do R2 tables appear but queries fail?","What should I do after rotating the R2 token?"],"navigation":true,"body":{"code":"var Component=(()=>{var g=Object.create;var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var y=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),k=(n,e)=>{for(var o in e)c(n,o,{get:e[o],enumerable:!0})},s=(n,e,o,a)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let r of f(e))!b.call(n,r)&&r!==o&&c(n,r,{get:()=>e[r],enumerable:!(a=p(e,r))||a.enumerable});return n};var C=(n,e,o)=>(o=n!=null?g(m(n)):{},s(e||!n||!n.__esModule?c(o,\"default\",{value:n,enumerable:!0}):o,n)),x=n=>s(c({},\"__esModule\",{value:!0}),n);var l=y((v,i)=>{i.exports=_jsx_runtime});var w={};k(w,{default:()=>u,frontmatter:()=>R});var t=C(l()),R={title:\"R2 Data Catalog\",description:\"Connect Cloudflare R2 Data Catalog to Altertable as an Iceberg REST catalog for open, governed lakehouse analytics.\",order:310,askSuggestions:[\"Which permissions does the R2 token need?\",\"Why do R2 tables appear but queries fail?\",\"What should I do after rotating the R2 token?\"]};function d(n){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",li:\"li\",ol:\"ol\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...n.components},{DocsPreviewDocument:o,DocsPreviewSection:a}=e;return o||h(\"DocsPreviewDocument\",!0),a||h(\"DocsPreviewSection\",!0),(0,t.jsxs)(o,{anchors:\"r2-data-catalog prerequisites connect-r2-data-catalog verify-the-connection troubleshooting\",children:[(0,t.jsxs)(a,{sectionId:\"r2-data-catalog\",sectionTitle:\"R2 Data Catalog\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,t.jsx)(e.h1,{id:\"r2-data-catalog\",children:\"R2 Data Catalog\"}),`\n`,(0,t.jsxs)(e.p,{children:[(0,t.jsx)(e.a,{href:\"https://developers.cloudflare.com/r2-data-catalog/\",children:\"Cloudflare R2 Data Catalog\"}),\" exposes Iceberg tables through an Iceberg REST catalog. Connect it to Altertable when your Iceberg metadata is managed by Cloudflare and you want to query those tables alongside the rest of your lakehouse.\"]}),`\n`]}),(0,t.jsxs)(a,{sectionId:\"prerequisites\",sectionTitle:\"Prerequisites\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,t.jsx)(e.h2,{id:\"prerequisites\",children:\"Prerequisites\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"Enable the catalog for the intended R2 bucket, then copy its \",(0,t.jsx)(e.strong,{children:\"Warehouse\"}),\" and \",(0,t.jsx)(e.strong,{children:\"Catalog URI\"}),\" from Cloudflare. The URI has the form \",(0,t.jsx)(e.code,{children:\"https://catalog.cloudflarestorage.com/<account-id>/<bucket-name>\"}),\"; use the exact value Cloudflare provides.\"]}),`\n`,(0,t.jsxs)(e.p,{children:[\"Create a token with both catalog and storage read permissions. An object-only token cannot list or load Iceberg catalog metadata. For a read-only connection, use Cloudflare's Admin Read only permissions and scope access to the intended resources. See \",(0,t.jsx)(e.a,{href:\"https://developers.cloudflare.com/r2/api/tokens/\",children:\"R2 token permissions\"}),\" for current permission groups and scopes.\"]}),`\n`]}),(0,t.jsxs)(a,{sectionId:\"connect-r2-data-catalog\",sectionTitle:\"Connect R2 Data Catalog\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,t.jsx)(e.h2,{id:\"connect-r2-data-catalog\",children:\"Connect R2 Data Catalog\"}),`\n`,(0,t.jsxs)(e.ol,{children:[`\n`,(0,t.jsxs)(e.li,{children:[\"Open \",(0,t.jsx)(e.strong,{children:\"Catalogs\"}),\" in the Altertable app.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[\"Click \",(0,t.jsx)(e.strong,{children:\"New catalog\"}),\".\"]}),`\n`,(0,t.jsxs)(e.li,{children:[\"Select \",(0,t.jsx)(e.strong,{children:\"R2 Data Catalog\"}),\".\"]}),`\n`,(0,t.jsx)(e.li,{children:\"Enter the warehouse, catalog URI, and token.\"}),`\n`,(0,t.jsx)(e.li,{children:\"Save the catalog.\"}),`\n`,(0,t.jsx)(e.li,{children:\"Query the exposed Iceberg tables with SQL.\"}),`\n`]}),`\n`,(0,t.jsx)(e.p,{children:\"Use a token scoped to the warehouse Altertable should read. If permissions change in Cloudflare, update or rotate the token in the catalog settings.\"}),`\n`]}),(0,t.jsxs)(a,{sectionId:\"verify-the-connection\",sectionTitle:\"Verify the connection\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,t.jsx)(e.h2,{id:\"verify-the-connection\",children:\"Verify the connection\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"Open the saved catalog and confirm that the expected namespaces and Iceberg tables appear. In \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/query/sql-explorer\",children:\"SQL Explorer\"}),\", replace the names with a real table:\"]}),`\n`,(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:\"language-sql\",children:`SELECT * FROM my_catalog.my_namespace.my_table LIMIT 10;\n`})}),`\n`,(0,t.jsx)(e.p,{children:\"Compare a known row with the source. This checks both catalog metadata access and the ability to read the underlying objects.\"}),`\n`]}),(0,t.jsxs)(a,{sectionId:\"troubleshooting\",sectionTitle:\"Troubleshooting\",anchors:\"\",ancestors:\"\",index:\"4\",children:[(0,t.jsx)(e.h2,{id:\"troubleshooting\",children:\"Troubleshooting\"}),`\n`,(0,t.jsxs)(e.ul,{children:[`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"Unauthorized:\"}),\" check the token's catalog and storage permissions, expiry, and resource scope.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"Warehouse not found:\"}),\" copy the warehouse and URI from the same bucket's catalog settings.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"Tables appear but queries fail:\"}),\" check the token's object-read access to the table's data and metadata files.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"A rotated token stops working:\"}),\" update the saved connection, then rerun the known-table query.\"]}),`\n`]})]})]})}function u(n={}){let{wrapper:e}=n.components||{};return e?(0,t.jsx)(e,{...n,children:(0,t.jsx)(d,{...n})}):d(n)}function h(n,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+n+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return x(w);})();\n;return Component;"},"_id":"docs/lakehouse/external-catalogs/r2-data-catalog.mdx","_raw":{"sourceFilePath":"docs/lakehouse/external-catalogs/r2-data-catalog.mdx","sourceFileName":"r2-data-catalog.mdx","sourceFileDir":"docs/lakehouse/external-catalogs","contentType":"mdx","flattenedPath":"docs/lakehouse/external-catalogs/r2-data-catalog"},"type":"Docs","path":"/lakehouse/external-catalogs/r2-data-catalog","level":3,"parent":"lakehouse/external-catalogs"}