{"title":"Query object storage","description":"Query files and Iceberg datasets in S3-compatible object storage from Altertable without moving data into another system.","order":150,"askSuggestions":["Which table type should I use for files in my bucket?","Why are some files missing from my mapped table?","How do I make bucket queries scan less data?"],"navigation":true,"routeId":"queryDataObjectStorage","body":{"code":"var Component=(()=>{var g=Object.create;var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var k=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),S=(n,e)=>{for(var a in e)c(n,a,{get:e[a],enumerable:!0})},h=(n,e,a,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of x(e))!q.call(n,o)&&o!==a&&c(n,o,{get:()=>e[o],enumerable:!(i=f(e,o))||i.enumerable});return n};var j=(n,e,a)=>(a=n!=null?g(y(n)):{},h(e||!n||!n.__esModule?c(a,\"default\",{value:n,enumerable:!0}):a,n)),I=n=>h(c({},\"__esModule\",{value:!0}),n);var p=k((w,u)=>{u.exports=_jsx_runtime});var A={};S(A,{default:()=>m,frontmatter:()=>v});var t=j(p()),v={title:\"Query object storage\",routeId:\"queryDataObjectStorage\",description:\"Query files and Iceberg datasets in S3-compatible object storage from Altertable without moving data into another system.\",order:150,askSuggestions:[\"Which table type should I use for files in my bucket?\",\"Why are some files missing from my mapped table?\",\"How do I make bucket queries scan less data?\"]};function b(n){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...n.components},{DocsAppAction:a,DocsCallout:i,DocsDetails:o,DocsPreviewDocument:l,DocsPreviewSection:r,DocsTable:d}=e;return a||s(\"DocsAppAction\",!0),i||s(\"DocsCallout\",!0),o||s(\"DocsDetails\",!0),l||s(\"DocsPreviewDocument\",!0),r||s(\"DocsPreviewSection\",!0),d||s(\"DocsTable\",!0),(0,t.jsxs)(l,{anchors:\"query-object-storage goal prerequisites steps 1-choose-a-table-type 2-query-a-mapped-table 3-join-another-catalog 4-explore-in-sql-explorer 5-improve-query-performance verification troubleshooting next-steps\",children:[(0,t.jsxs)(r,{sectionId:\"query-object-storage\",sectionTitle:\"Query object storage\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,t.jsx)(e.h1,{id:\"query-object-storage\",children:\"Query object storage\"}),`\n`,(0,t.jsx)(e.p,{children:\"Altertable can query data that already lives in Amazon S3, Cloudflare R2, Google Cloud Storage, or another S3-compatible bucket. Map the files once, then use the same SQL engine and query interfaces you use for Altertable catalogs.\"}),`\n`,(0,t.jsx)(e.p,{children:\"Object storage queries run in place. Altertable reads mapped files from the connected bucket.\"}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"goal\",sectionTitle:\"Goal\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,t.jsx)(e.h2,{id:\"goal\",children:\"Goal\"}),`\n`,(0,t.jsx)(e.p,{children:\"Map an object-storage dataset, query it with a fully qualified table name, and join it with another Altertable catalog.\"}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"prerequisites\",sectionTitle:\"Prerequisites\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,t.jsx)(e.h2,{id:\"prerequisites\",children:\"Prerequisites\"}),`\n`,(0,t.jsxs)(e.ul,{children:[`\n`,(0,t.jsx)(e.li,{children:\"An S3-compatible bucket containing Parquet, CSV, JSON, Iceberg, or S3 Tables data.\"}),`\n`,(0,t.jsx)(e.li,{children:\"Permission for Altertable to read the intended bucket paths and metadata.\"}),`\n`,(0,t.jsxs)(e.li,{children:[\"A \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/external-catalogs\",children:\"mapped external catalog\"}),\", or the connection details needed to create one.\"]}),`\n`]}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"steps\",sectionTitle:\"Steps\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,t.jsx)(e.h2,{id:\"steps\",children:\"Steps\"}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"1-choose-a-table-type\",sectionTitle:\"1. Choose a table type\",anchors:\"\",ancestors:\"steps\",index:\"4\",children:[(0,t.jsx)(e.h3,{id:\"1-choose-a-table-type\",children:\"1. Choose a table type\"}),`\n`,(0,t.jsx)(d,{columns:[\"Source\",\"Best fit\",\"Learn more\"],data:[{Source:\"Parquet, CSV, or JSON files\",\"Best fit\":\"Query file paths and prefixes as external tables\",\"Learn more\":\"[Bucket Tables](/docs/lakehouse/external-catalogs/bucket-tables)\"},{Source:\"Apache Iceberg datasets\",\"Best fit\":\"Query datasets through Iceberg table metadata\",\"Learn more\":\"[Iceberg Tables](/docs/lakehouse/external-catalogs/iceberg-tables)\"},{Source:\"Amazon S3 table buckets\",\"Best fit\":\"Query AWS-managed Iceberg table buckets\",\"Learn more\":\"[S3 Tables](/docs/lakehouse/external-catalogs/s3-tables)\"}]}),`\n`,(0,t.jsx)(e.p,{children:\"Follow the guide for the selected source to map its files or metadata as a table.\"}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"2-query-a-mapped-table\",sectionTitle:\"2. Query a mapped table\",anchors:\"\",ancestors:\"steps\",index:\"5\",children:[(0,t.jsx)(e.h3,{id:\"2-query-a-mapped-table\",children:\"2. Query a mapped table\"}),`\n`,(0,t.jsx)(e.p,{children:\"After you map object storage, query the exposed tables with fully qualified names:\"}),`\n`,(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:\"language-sql\",children:`SELECT\n  event_name,\n  count(*) AS event_count\nFROM bucket_exports.main.events\nWHERE event_date >= DATE '2026-01-01'\nGROUP BY event_name\nORDER BY event_count DESC;\n`})}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"3-join-another-catalog\",sectionTitle:\"3. Join another catalog\",anchors:\"\",ancestors:\"steps\",index:\"6\",children:[(0,t.jsx)(e.h3,{id:\"3-join-another-catalog\",children:\"3. Join another catalog\"}),`\n`,(0,t.jsx)(e.p,{children:\"Mapped object-storage tables can be joined with Altertable-managed catalogs and other external catalogs:\"}),`\n`,(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:\"language-sql\",children:`SELECT\n  customers.segment,\n  count(*) AS events\nFROM bucket_exports.main.events\nJOIN analytics.main.customers\n  ON events.customer_id = customers.customer_id\nGROUP BY customers.segment;\n`})}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"4-explore-in-sql-explorer\",sectionTitle:\"4. Explore in SQL Explorer\",anchors:\"\",ancestors:\"steps\",index:\"7\",children:[(0,t.jsx)(e.h3,{id:\"4-explore-in-sql-explorer\",children:\"4. Explore in SQL Explorer\"}),`\n`,(0,t.jsxs)(e.p,{children:[\"Start in \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/query/sql-explorer\",children:\"SQL Explorer\"}),\" to inspect results and refine your query.\"]}),`\n`,(0,t.jsx)(o,{title:\"Use another query interface\",children:(0,t.jsxs)(e.ul,{children:[`\n`,(0,t.jsxs)(e.li,{children:[\"Use the \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/query/http-api\",children:\"HTTP API\"}),\" from application code.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[\"Use \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/query/duckdb\",children:\"DuckDB\"}),\" for local analysis and file joins.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[\"Use the \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/clients/postgres\",children:\"Postgres adapter\"}),\" or \",(0,t.jsx)(e.a,{href:\"/docs/lakehouse/clients/arrow-flight-sql\",children:\"Arrow Flight SQL\"}),\" when your BI tool needs a database protocol.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[\"Use \",(0,t.jsx)(e.a,{href:\"/docs/agents/ask\",children:\"Ask Altertable\"}),\" to investigate in conversation.\"]}),`\n`]})}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"5-improve-query-performance\",sectionTitle:\"5. Improve query performance\",anchors:\"\",ancestors:\"steps\",index:\"8\",children:[(0,t.jsx)(e.h3,{id:\"5-improve-query-performance\",children:\"5. Improve query performance\"}),`\n`,(0,t.jsx)(i,{title:\"Recommendation: use columnar formats\",children:(0,t.jsx)(e.p,{children:\"For large object-storage datasets, prefer columnar formats such as Parquet or Iceberg, keep partitions predictable, and filter on partition columns when possible. Altertable can query CSV and JSON files, but columnar formats usually scan less data and return results faster.\"})}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"verification\",sectionTitle:\"Verification\",anchors:\"\",ancestors:\"\",index:\"9\",children:[(0,t.jsx)(e.h2,{id:\"verification\",children:\"Verification\"}),`\n`,(0,t.jsx)(e.p,{children:\"Run a small count against the mapped table:\"}),`\n`,(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:\"language-sql\",children:`SELECT count(*) AS row_count\nFROM bucket_exports.main.events;\n`})}),`\n`,(0,t.jsxs)(e.p,{children:[\"Confirm that \",(0,t.jsx)(e.code,{children:\"row_count\"}),\" is consistent with the files or Iceberg dataset mapped to the table.\"]}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"troubleshooting\",sectionTitle:\"Troubleshooting\",anchors:\"\",ancestors:\"\",index:\"10\",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:\"The table is not found:\"}),\" qualify it with the mapped catalog and schema, then confirm the exposed table name.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"Files are missing:\"}),\" check that the mapped path or prefix includes the expected objects.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"The bucket cannot be read:\"}),\" verify the object-storage credentials and permissions for the mapped paths and metadata.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"Queries scan too much data:\"}),\" prefer Parquet or Iceberg, keep partitions predictable, and filter on partition columns.\"]}),`\n`,(0,t.jsxs)(e.li,{children:[(0,t.jsx)(e.strong,{children:\"A join returns no rows:\"}),\" inspect the join-key types and values in each catalog before joining them.\"]}),`\n`]}),`\n`,(0,t.jsx)(a,{destination:\"createCatalog\"}),`\n`]}),(0,t.jsxs)(r,{sectionId:\"next-steps\",sectionTitle:\"Next steps\",anchors:\"\",ancestors:\"\",index:\"11\",children:[(0,t.jsx)(e.h2,{id:\"next-steps\",children:\"Next steps\"}),`\n`,(0,t.jsxs)(e.ul,{children:[`\n`,(0,t.jsx)(e.li,{children:(0,t.jsx)(e.a,{href:\"/docs/lakehouse/external-catalogs/bucket-tables\",children:\"Map bucket tables\"})}),`\n`,(0,t.jsx)(e.li,{children:(0,t.jsx)(e.a,{href:\"/docs/lakehouse/external-catalogs/iceberg-tables\",children:\"Map Iceberg tables\"})}),`\n`,(0,t.jsx)(e.li,{children:(0,t.jsx)(e.a,{href:\"/docs/lakehouse/external-catalogs/s3-tables\",children:\"Map Amazon S3 Tables\"})}),`\n`,(0,t.jsx)(e.li,{children:(0,t.jsx)(e.a,{href:\"/docs/lakehouse/query/sql-explorer\",children:\"Query with SQL Explorer\"})}),`\n`]})]})]})}function m(n={}){let{wrapper:e}=n.components||{};return e?(0,t.jsx)(e,{...n,children:(0,t.jsx)(b,{...n})}):b(n)}function s(n,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+n+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return I(A);})();\n;return Component;"},"_id":"docs/lakehouse/query/object-storage.mdx","_raw":{"sourceFilePath":"docs/lakehouse/query/object-storage.mdx","sourceFileName":"object-storage.mdx","sourceFileDir":"docs/lakehouse/query","contentType":"mdx","flattenedPath":"docs/lakehouse/query/object-storage"},"type":"Docs","path":"/lakehouse/query/object-storage","level":3,"parent":"lakehouse/query"}