Skip to content

Introduce "psql" command to connect to Lakebase instances #3128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 16, 2025

Conversation

anton-107
Copy link
Contributor

@anton-107 anton-107 commented Jun 26, 2025

Changes

Adds "databricks psql" command to Databricks CLI

Usage:
databricks psql <your db instance name>

Command also supports auto-complete and selector for the instance name:
databricks psql<ENTER> for drop-down
databricks psql <TAB><TAB> for auto-complete

Why

Lakebase provides API calls to fetch database credentials, but then it is up to the user to run their psql client and provide those credentials there. This change allows users to connect to their Lakebase instance with a single command

Tests

Manual local tests via building the CLI and running the introduced command against Databricks workspace
Local-only acceptance test added for Linux and Darwin platforms
Manual end-to-end test on Windows platform

@anton-107 anton-107 temporarily deployed to test-trigger-is June 26, 2025 10:45 — with GitHub Actions Inactive
@anton-107 anton-107 force-pushed the anton-107/lakebase-connect branch from 27ae1f5 to ef52279 Compare July 9, 2025 10:52
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 10:52 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Jul 9, 2025

Run: 16316416168

Env ✅‌pass 🙈‌skip
✅‌ aws linux 302 424
✅‌ aws windows 303 423
✅‌ aws-ucws linux 408 324
✅‌ aws-ucws windows 409 323
✅‌ azure linux 302 423
✅‌ azure windows 303 422
✅‌ azure-ucws linux 410 321
✅‌ azure-ucws windows 411 320
✅‌ gcp linux 301 425
✅‌ gcp windows 302 424

@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 12:08 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 12:36 — with GitHub Actions Inactive
@anton-107 anton-107 changed the title Introduce "connect" command to connect to Lakebase instances Introduce "psql" command to connect to Lakebase instances Jul 9, 2025
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 12:39 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 12:52 — with GitHub Actions Inactive
@anton-107 anton-107 force-pushed the anton-107/lakebase-connect branch from dd6e12c to d0aeebf Compare July 9, 2025 13:18
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 13:18 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 13:34 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 13:57 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 14:17 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 14:28 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 15:03 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 9, 2025 15:09 — with GitHub Actions Inactive
@anton-107 anton-107 marked this pull request as ready for review July 9, 2025 15:16
Copy link
Contributor

@shreyas-goenka shreyas-goenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the PR description. It refers to the databricks connect command.

@anton-107 anton-107 force-pushed the anton-107/lakebase-connect branch from 7820548 to f400e10 Compare July 11, 2025 13:35
@anton-107 anton-107 temporarily deployed to test-trigger-is July 11, 2025 13:35 — with GitHub Actions Inactive
@anton-107 anton-107 added the Bug Something isn't working label Jul 11, 2025
@anton-107 anton-107 temporarily deployed to test-trigger-is July 11, 2025 15:17 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 11, 2025 15:19 — with GitHub Actions Inactive
@anton-107 anton-107 temporarily deployed to test-trigger-is July 11, 2025 15:44 — with GitHub Actions Inactive
anton-107 and others added 23 commits July 16, 2025 11:59
<!-- Brief summary of your changes that is easy to understand -->

<!-- Why are these changes needed? Provide the context that the reviewer
might be missing.
For example, were there any decisions behind the change that are not
reflected in the code itself? -->

<!-- How have you tested the changes? -->

<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->

add a local-only acceptance test

add test output files

execute psql command using exec.Execv

add support for by-passing arguments to psql
## Changes
<!-- Brief summary of your changes that is easy to understand -->

## Why
<!-- Why are these changes needed? Provide the context that the reviewer
might be missing.
For example, were there any decisions behind the change that are not
reflected in the code itself? -->

## Tests
<!-- How have you tested the changes? -->

<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
Co-authored-by: Pieter Noordhuis <[email protected]>
@anton-107 anton-107 force-pushed the anton-107/lakebase-connect branch from 7b1be11 to 99cda31 Compare July 16, 2025 09:59
@anton-107 anton-107 temporarily deployed to test-trigger-is July 16, 2025 09:59 — with GitHub Actions Inactive
@anton-107 anton-107 merged commit f98d891 into main Jul 16, 2025
12 of 13 checks passed
@anton-107 anton-107 deleted the anton-107/lakebase-connect branch July 16, 2025 10:26
deco-sdk-tagging bot added a commit that referenced this pull request Jul 16, 2025
## Release v0.260.0

### Notable Changes
* Added support for creating SQL warehouses in DABs ([#3129](#3129))

### Dependency updates
* Upgrade Go SDK to 0.75.0 ([#3256](#3256))

### CLI
* Add `databricks psql` command to connect to Lakebase with a single command ([#3128](#3128))

### Bundles

 * Jobs that use cluster policy default values for their cluster configuration now correctly update those defaults on every deployment ([#3255](#3255)).
 * Add upper and lower helper methods for bundle templates ([#3242](#3242))
github-merge-queue bot pushed a commit that referenced this pull request Jul 18, 2025
…rectory is provided (#3267)

## Why
<!-- Why are these changes needed? Provide the context that the reviewer
might be missing.
For example, were there any decisions behind the change that are not
reflected in the code itself? -->

This is a follow-up for the comment in the previous PR #3128 :
#3128 (comment)

## Tests
<!-- How have you tested the changes? -->
- Existing acceptance test on cmd/psql is still passing even though the
production code is not specifying a directory
- Manually checked that when executed with `pwd` the process prints
current working directory on Mac and on Windows

<!-- If your PR needs to be included in the release notes for next
release,
add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants