{"title":"Connect a Postgres database","description":"Add Postgres as an external catalog in Altertable for unified analytics. Query across Postgres and other sources with the federated query engine.","order":0,"askSuggestions":["How do I let Altertable reach a Postgres behind a firewall?","How do I join Postgres tables with other catalogs?"],"navigation":true,"body":{"code":"var Component=(()=>{var u=Object.create;var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},i=(t,e,o,s)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let r of m(e))!w.call(t,r)&&r!==o&&c(t,r,{get:()=>e[r],enumerable:!(s=f(e,r))||s.enumerable});return t};var P=(t,e,o)=>(o=t!=null?u(p(t)):{},i(e||!t||!t.__esModule?c(o,\"default\",{value:t,enumerable:!0}):o,t)),x=t=>i(c({},\"__esModule\",{value:!0}),t);var h=y((v,l)=>{l.exports=_jsx_runtime});var C={};b(C,{default:()=>g,frontmatter:()=>S});var n=P(h()),S={title:\"Connect a Postgres database\",description:\"Add Postgres as an external catalog in Altertable for unified analytics. Query across Postgres and other sources with the federated query engine.\",order:0,askSuggestions:[\"How do I let Altertable reach a Postgres behind a firewall?\",\"How do I join Postgres tables with other catalogs?\"]};function d(t){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",li:\"li\",ol:\"ol\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...t.components},{DocsPreviewDocument:o,DocsPreviewSection:s,Screenshot:r}=e;return o||a(\"DocsPreviewDocument\",!0),s||a(\"DocsPreviewSection\",!0),r||a(\"Screenshot\",!0),(0,n.jsxs)(o,{anchors:\"connect-a-postgres-database connect-the-catalog verify-the-connection\",children:[(0,n.jsxs)(s,{sectionId:\"connect-a-postgres-database\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,n.jsx)(e.h1,{id:\"connect-a-postgres-database\",children:\"Connect a Postgres database\"}),`\n`,(0,n.jsx)(e.p,{children:\"Add your Postgres database as an external catalog in Altertable to query and analyze it alongside your other data sources.\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Before connecting, make sure Altertable can reach your source. Configure \",(0,n.jsx)(e.a,{href:\"/docs/administration/network\",children:\"network access\"}),\" if it requires an IP allowlist or SSH tunnel. Use credentials for the source database, rather than Altertable lakehouse credentials.\"]}),`\n`]}),(0,n.jsxs)(s,{sectionId:\"connect-the-catalog\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,n.jsx)(e.h2,{id:\"connect-the-catalog\",children:\"Connect the catalog\"}),`\n`,(0,n.jsxs)(e.ol,{children:[`\n`,(0,n.jsxs)(e.li,{children:[\"Open \",(0,n.jsx)(e.strong,{children:\"Catalogs\"}),\" and choose \",(0,n.jsx)(e.strong,{children:\"New catalog\"}),\".\"]}),`\n`,(0,n.jsxs)(e.li,{children:[\"Select \",(0,n.jsx)(e.strong,{children:\"PostgreSQL\"}),\" as the engine.\"]}),`\n`,(0,n.jsxs)(e.li,{children:[\"Fill in the connection details:\",`\n`,(0,n.jsxs)(e.ul,{children:[`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Host\"}),\": The hostname or IP address of your Postgres server\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Port\"}),\": The port number (default: 5432)\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Database\"}),\": The name of the database to connect to\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Schema\"}),\" (optional): The name of the schema to connect to\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Username\"}),\": Your Postgres username\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Password\"}),\": Your Postgres password\"]}),`\n`]}),`\n`]}),`\n`,(0,n.jsxs)(e.li,{children:[\"Choose \",(0,n.jsx)(e.strong,{children:\"Connect\"}),\" to create the catalog.\"]}),`\n`]}),`\n`,(0,n.jsx)(r,{story:\"components-connectionform--postgres-empty\",caption:\"New PostgreSQL connection form\",width:\"1408\",height:\"2028\"}),`\n`]}),(0,n.jsxs)(s,{sectionId:\"verify-the-connection\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,n.jsx)(e.h2,{id:\"verify-the-connection\",children:\"Verify the connection\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Open \",(0,n.jsx)(e.a,{href:\"/docs/lakehouse/query/sql-explorer\",children:\"SQL Explorer\"}),\" and inspect the new catalog's schemas and tables. Replace the example identifiers with names from your source:\"]}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-sql\",children:`SELECT * FROM my_source.my_schema.my_table LIMIT 10;\n`})}),`\n`,(0,n.jsxs)(e.p,{children:[\"Compare the returned rows with the source. You can then \",(0,n.jsx)(e.a,{href:\"/docs/lakehouse/sql-engine#federated-queries\",children:\"join tables across catalogs\"}),\".\"]})]})]})}function g(t={}){let{wrapper:e}=t.components||{};return e?(0,n.jsx)(e,{...t,children:(0,n.jsx)(d,{...t})}):d(t)}function a(t,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+t+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return x(C);})();\n;return Component;"},"_id":"docs/lakehouse/external-catalogs/postgres.mdx","_raw":{"sourceFilePath":"docs/lakehouse/external-catalogs/postgres.mdx","sourceFileName":"postgres.mdx","sourceFileDir":"docs/lakehouse/external-catalogs","contentType":"mdx","flattenedPath":"docs/lakehouse/external-catalogs/postgres"},"type":"Docs","path":"/lakehouse/external-catalogs/postgres","level":3,"parent":"lakehouse/external-catalogs"}