{"title":"Altertable CLI","description":"Install the Altertable CLI, log in to your environment, and verify your first query. Find advanced commands and options in the CLI reference.","order":600,"askSuggestions":["How do I switch the CLI to another environment?","Why do queries fail when CLI login works?","How do I upload a file with the CLI?"],"navigation":true,"routeId":"developerToolingCli","body":{"code":"var Component=(()=>{var g=Object.create;var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var v=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),I=(r,e)=>{for(var i in e)c(r,i,{get:e[i],enumerable:!0})},d=(r,e,i,o)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let t of y(e))!w.call(r,t)&&t!==i&&c(r,t,{get:()=>e[t],enumerable:!(o=m(e,t))||o.enumerable});return r};var C=(r,e,i)=>(i=r!=null?g(b(r)):{},d(e||!r||!r.__esModule?c(i,\"default\",{value:r,enumerable:!0}):i,r)),L=r=>d(c({},\"__esModule\",{value:!0}),r);var u=v((D,h)=>{h.exports=_jsx_runtime});var x={};I(x,{default:()=>f,frontmatter:()=>q});var n=C(u()),q={title:\"Altertable CLI\",routeId:\"developerToolingCli\",description:\"Install the Altertable CLI, log in to your environment, and verify your first query. Find advanced commands and options in the CLI reference.\",order:600,askSuggestions:[\"How do I switch the CLI to another environment?\",\"Why do queries fail when CLI login works?\",\"How do I upload a file with the CLI?\"]};function p(r){let e={a:\"a\",code:\"code\",h1:\"h1\",h2:\"h2\",li:\"li\",p:\"p\",pre:\"pre\",strong:\"strong\",ul:\"ul\",...r.components},{DocsCliInstallCommand:i,DocsDetails:o,DocsPreviewDocument:t,DocsPreviewSection:l,DocsPrompt:s}=e;return i||a(\"DocsCliInstallCommand\",!0),o||a(\"DocsDetails\",!0),t||a(\"DocsPreviewDocument\",!0),l||a(\"DocsPreviewSection\",!0),s||a(\"DocsPrompt\",!0),(0,n.jsxs)(t,{anchors:\"altertable-cli set-up-with-your-agent 1-install-the-cli 2-log-in 3-verify-your-first-query monitor-running-queries troubleshooting\",children:[(0,n.jsxs)(l,{sectionId:\"altertable-cli\",anchors:\"\",ancestors:\"\",index:\"0\",children:[(0,n.jsx)(e.h1,{id:\"altertable-cli\",children:\"Altertable CLI\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"Install the CLI, log in, and run a first query. You need an Altertable account with access to an \",(0,n.jsx)(e.a,{href:\"/docs/administration\",children:\"organization and environment\"}),\".\"]}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"set-up-with-your-agent\",anchors:\"\",ancestors:\"\",index:\"1\",children:[(0,n.jsx)(e.h2,{id:\"set-up-with-your-agent\",children:\"Set up with your agent\"}),`\n`,(0,n.jsx)(s,{children:(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-text\",children:`Set up the Altertable CLI in this environment. Follow https://altertable.ai/docs/lakehouse/clients/cli.md.\n\nDetect my operating system, shell, and any existing CLI installation. Install or reuse the supported CLI and preserve existing profiles. Guide me through browser login, then confirm the intended organization and environment with the active profile.\n\nVerify lakehouse credentials are available without printing them. Run SELECT 1 AS connected and confirm the returned value is 1. Use --agent when the agent consumes structured CLI output. Report the installed version, active profile, verification result, and any remaining setup. Do not ingest data or change remote resources during this setup.\n`})})}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"1-install-the-cli\",anchors:\"\",ancestors:\"\",index:\"2\",children:[(0,n.jsx)(e.h2,{id:\"1-install-the-cli\",children:\"1. Install the CLI\"}),`\n`,(0,n.jsx)(e.p,{children:\"Run the installer in your terminal:\"}),`\n`,(0,n.jsx)(i,{}),`\n`,(0,n.jsxs)(o,{title:\"Other installation methods\",children:[(0,n.jsx)(e.p,{children:\"Install from npm:\"}),(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-bash\",children:`npm install -g @altertable/cli\n`})}),(0,n.jsxs)(e.p,{children:[\"You can also download a binary for your operating system from \",(0,n.jsx)(e.a,{href:\"https://github.com/altertable-ai/altertable-cli/releases\",children:\"GitHub Releases\"}),\".\"]})]}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"2-log-in\",anchors:\"\",ancestors:\"\",index:\"3\",children:[(0,n.jsx)(e.h2,{id:\"2-log-in\",children:\"2. Log in\"}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-altertable\",children:`altertable login\n`})}),`\n`,(0,n.jsx)(e.p,{children:\"Complete browser login and choose your organization and environment. The CLI creates or reuses a local profile with those settings. The first lakehouse command automatically provisions temporary credentials for that profile. You do not need to copy credentials for this login-based workflow.\"}),`\n`,(0,n.jsxs)(e.p,{children:[\"For environment-variable configuration, supply \",(0,n.jsx)(e.code,{children:\"ALTERTABLE_BASIC_AUTH_TOKEN\"}),\" or \",(0,n.jsx)(e.code,{children:\"ALTERTABLE_LAKEHOUSE_USERNAME\"}),\" and \",(0,n.jsx)(e.code,{children:\"ALTERTABLE_LAKEHOUSE_PASSWORD\"}),\" explicitly. Automatic provisioning applies to stored profiles with management access. See \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-profile-configure\",children:\"profile configuration\"}),\" for manually configured profiles.\"]}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"3-verify-your-first-query\",anchors:\"\",ancestors:\"\",index:\"4\",children:[(0,n.jsx)(e.h2,{id:\"3-verify-your-first-query\",children:\"3. Verify your first query\"}),`\n`,(0,n.jsx)(e.p,{children:\"Check that the active profile points to the intended environment, then run a query that needs no existing table:\"}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-altertable\",children:`altertable profile show\naltertable query \"SELECT 1 AS connected\"\n`})}),`\n`,(0,n.jsxs)(e.p,{children:[\"The query should return a \",(0,n.jsx)(e.code,{children:\"connected\"}),\" column with the value \",(0,n.jsx)(e.code,{children:\"1\"}),\".\"]}),`\n`,(0,n.jsxs)(e.p,{children:[\"Next, \",(0,n.jsx)(e.a,{href:\"/docs/getting-started/ingest-data\",children:\"ingest your first data\"}),\" and read it back.\"]}),`\n`,(0,n.jsxs)(o,{title:\"More CLI workflows\",children:[(0,n.jsxs)(e.ul,{children:[`\n`,(0,n.jsx)(e.li,{children:(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-query\",children:\"Query options, SQL files, and output formats\"})}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-append\",children:\"Append records\"}),\", \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-upload\",children:\"upload files\"}),\", and \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-upsert\",children:\"upsert rows\"})]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-profile\",children:\"Manage profiles\"}),\" and \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-login\",children:\"log in as a service account\"})]}),`\n`,(0,n.jsx)(e.li,{children:(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-api\",children:\"Call the management API\"})}),`\n`,(0,n.jsx)(e.li,{children:(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-app\",children:\"Develop data apps\"})}),`\n`,(0,n.jsx)(e.li,{children:(0,n.jsx)(e.a,{href:\"/docs/agents/cli\",children:\"Use the CLI with agents\"})}),`\n`]}),(0,n.jsxs)(e.p,{children:[\"For all commands and global flags, see the \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli\",children:\"CLI reference\"}),\".\"]})]}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"monitor-running-queries\",anchors:\"\",ancestors:\"\",index:\"5\",children:[(0,n.jsx)(e.h2,{id:\"monitor-running-queries\",children:\"Monitor running queries\"}),`\n`,(0,n.jsx)(e.p,{children:\"Use the active profile to inspect queries and refresh their progress:\"}),`\n`,(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:\"language-altertable\",children:`altertable query list\naltertable query top --watch --interval 5\naltertable query show <query-id>\naltertable query cancel <query-id>\n`})}),`\n`,(0,n.jsxs)(e.p,{children:[\"Environment credentials can see all running queries in the environment; principal credentials see only their own. Press Ctrl+C to leave the live monitor. Use \",(0,n.jsx)(e.code,{children:\"query cancel\"}),\" when you intend to stop a query.\"]}),`\n`]}),(0,n.jsxs)(l,{sectionId:\"troubleshooting\",anchors:\"\",ancestors:\"\",index:\"6\",children:[(0,n.jsx)(e.h2,{id:\"troubleshooting\",children:\"Troubleshooting\"}),`\n`,(0,n.jsxs)(e.ul,{children:[`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Credentials expired:\"}),\" run \",(0,n.jsx)(e.code,{children:\"altertable login\"}),\" again.\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Wrong environment:\"}),\" \",(0,n.jsx)(e.a,{href:\"/docs/api-references/cli#altertable-profile-switch\",children:\"switch to the correct profile\"}),\".\"]}),`\n`,(0,n.jsxs)(e.li,{children:[(0,n.jsx)(e.strong,{children:\"Login works but queries fail:\"}),\" check the profile's \",(0,n.jsx)(e.a,{href:\"/docs/administration/lakehouse-credentials\",children:\"lakehouse credentials\"}),\".\"]}),`\n`]})]})]})}function f(r={}){let{wrapper:e}=r.components||{};return e?(0,n.jsx)(e,{...r,children:(0,n.jsx)(p,{...r})}):p(r)}function a(r,e){throw new Error(\"Expected \"+(e?\"component\":\"object\")+\" `\"+r+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return L(x);})();\n;return Component;"},"_id":"docs/lakehouse/clients/cli.mdx","_raw":{"sourceFilePath":"docs/lakehouse/clients/cli.mdx","sourceFileName":"cli.mdx","sourceFileDir":"docs/lakehouse/clients","contentType":"mdx","flattenedPath":"docs/lakehouse/clients/cli"},"type":"Docs","path":"/lakehouse/clients/cli","level":3,"parent":"lakehouse/clients"}