databricks-external-access 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. databricks_external_access-0.1.1/.gitattributes +1 -0
  2. databricks_external_access-0.1.1/.github/CODEOWNERS +1 -0
  3. databricks_external_access-0.1.1/.github/ISSUE_TEMPLATE/bug_report.yml +38 -0
  4. databricks_external_access-0.1.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
  5. databricks_external_access-0.1.1/.github/ISSUE_TEMPLATE/feature_request.yml +15 -0
  6. databricks_external_access-0.1.1/.github/dependabot.yml +23 -0
  7. databricks_external_access-0.1.1/.github/pull_request_template.md +9 -0
  8. databricks_external_access-0.1.1/.github/workflows/ci.yml +109 -0
  9. databricks_external_access-0.1.1/.github/workflows/release.yml +106 -0
  10. databricks_external_access-0.1.1/.gitignore +11 -0
  11. databricks_external_access-0.1.1/.python-version +1 -0
  12. databricks_external_access-0.1.1/CHANGELOG.md +31 -0
  13. databricks_external_access-0.1.1/CONTRIBUTING.md +98 -0
  14. databricks_external_access-0.1.1/Justfile +19 -0
  15. databricks_external_access-0.1.1/LICENSE +21 -0
  16. databricks_external_access-0.1.1/PKG-INFO +125 -0
  17. databricks_external_access-0.1.1/README.md +98 -0
  18. databricks_external_access-0.1.1/SECURITY.md +16 -0
  19. databricks_external_access-0.1.1/docs/design.md +91 -0
  20. databricks_external_access-0.1.1/docs/requirements.md +65 -0
  21. databricks_external_access-0.1.1/notebooks/tutorial.ipynb +221 -0
  22. databricks_external_access-0.1.1/notes.md +6 -0
  23. databricks_external_access-0.1.1/pyproject.toml +80 -0
  24. databricks_external_access-0.1.1/src/databricks_external_access/__init__.py +29 -0
  25. databricks_external_access-0.1.1/src/databricks_external_access/_workspace.py +100 -0
  26. databricks_external_access-0.1.1/src/databricks_external_access/browse.py +109 -0
  27. databricks_external_access-0.1.1/src/databricks_external_access/errors.py +23 -0
  28. databricks_external_access-0.1.1/src/databricks_external_access/fetch.py +196 -0
  29. databricks_external_access-0.1.1/src/databricks_external_access/py.typed +0 -0
  30. databricks_external_access-0.1.1/tests/conftest.py +93 -0
  31. databricks_external_access-0.1.1/tests/test_browse.py +177 -0
  32. databricks_external_access-0.1.1/tests/test_fetch.py +160 -0
  33. databricks_external_access-0.1.1/tests/test_integration.py +45 -0
  34. databricks_external_access-0.1.1/tests/test_notebook.py +21 -0
  35. databricks_external_access-0.1.1/uv.lock +2839 -0
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1 @@
1
+ * @northbridgeops
@@ -0,0 +1,38 @@
1
+ name: Bug report
2
+ description: Something does not work as documented
3
+ labels: [bug]
4
+ body:
5
+ - type: textarea
6
+ id: what
7
+ attributes:
8
+ label: What happened, and what did you expect?
9
+ description: Include the full error message. Never paste tokens, credentials or private data.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: repro
14
+ attributes:
15
+ label: Minimal code to reproduce
16
+ render: python
17
+ validations:
18
+ required: true
19
+ - type: dropdown
20
+ id: table-kind
21
+ attributes:
22
+ label: Kind of table involved
23
+ options:
24
+ - Not table-specific (browsing, sign-in)
25
+ - Streaming table (Lakeflow)
26
+ - Materialized view (Lakeflow)
27
+ - Managed Delta table
28
+ - External Delta table
29
+ - Other
30
+ validations:
31
+ required: true
32
+ - type: input
33
+ id: versions
34
+ attributes:
35
+ label: Versions and platform
36
+ description: "Output of: python -c \"import sys, duckdb, databricks.sdk as s; print(sys.version, duckdb.__version__, s.version.__version__)\" plus your OS and cloud (AWS/Azure/GCP)."
37
+ validations:
38
+ required: true
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Report a security vulnerability
4
+ url: https://github.com/Northbridge-Capital/databricks-external-access/security/advisories/new
5
+ about: Please report vulnerabilities privately, not as a public issue.
@@ -0,0 +1,15 @@
1
+ name: Feature request
2
+ description: Suggest an addition or change
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What are you trying to do?
9
+ description: Describe the problem first; a solution can follow.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: idea
14
+ attributes:
15
+ label: What would you like to see?
@@ -0,0 +1,23 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ cooldown:
8
+ default-days: 7 # let a release age a week before adopting it (security updates are exempt)
9
+ groups:
10
+ actions:
11
+ patterns: ["*"]
12
+
13
+ # duckdb and databricks-sdk are the two runtime dependencies; a new release of either can
14
+ # break reading Lakeflow tables, so they get their own PRs and are never grouped.
15
+ - package-ecosystem: uv
16
+ directory: /
17
+ schedule:
18
+ interval: weekly
19
+ cooldown:
20
+ default-days: 7 # let a release age a week before adopting it (security updates are exempt)
21
+ groups:
22
+ dev-tools:
23
+ dependency-type: development
@@ -0,0 +1,9 @@
1
+ ## What and why
2
+
3
+ <!-- What does this change, and why? Link the issue it closes. -->
4
+
5
+ ## Checklist
6
+
7
+ - [ ] `just lint` and `just test` pass
8
+ - [ ] README, docstrings and `CHANGELOG.md` (under `[Unreleased]`) are updated
9
+ - [ ] Anything that reads data was checked against a real workspace (the integration test), or this change does not touch `fetch.py`
@@ -0,0 +1,109 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ci-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ env:
17
+ PYTHONDONTWRITEBYTECODE: 1
18
+
19
+ jobs:
20
+ lint:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
24
+ with:
25
+ persist-credentials: false
26
+
27
+ - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
28
+ with:
29
+ version: "0.11.26" # keep in sync with release.yml
30
+ enable-cache: true
31
+
32
+ - run: uv sync --locked
33
+ - run: uv run ruff check .
34
+ - run: uv run ruff format --check .
35
+ - run: uv run basedpyright
36
+ # Workflows are code too: lint them and audit them for security problems.
37
+ - run: uvx --from actionlint-py==1.7.12.25 actionlint
38
+ - run: uvx zizmor@1.33.1 --no-progress --min-severity medium .github
39
+
40
+ # The package must work on every OS and on both ends of the supported Python range.
41
+ # The integration test skips itself here because CI has no Databricks sign-in.
42
+ test:
43
+ strategy:
44
+ fail-fast: false
45
+ matrix:
46
+ os: [ubuntu-latest, macos-latest, windows-latest]
47
+ python: ["3.11", "3.13"]
48
+ runs-on: ${{ matrix.os }}
49
+ steps:
50
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51
+ with:
52
+ persist-credentials: false
53
+
54
+ - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
55
+ with:
56
+ version: "0.11.26" # keep in sync with release.yml
57
+ enable-cache: true
58
+ python-version: ${{ matrix.python }}
59
+
60
+ - run: uv sync --locked
61
+ - run: uv run pytest --cov --cov-fail-under=95
62
+
63
+ # The lower bounds in pyproject.toml must actually work, not just the locked versions.
64
+ test-lowest:
65
+ runs-on: ubuntu-latest
66
+ steps:
67
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
68
+ with:
69
+ persist-credentials: false
70
+
71
+ - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
72
+ with:
73
+ version: "0.11.26" # keep in sync with release.yml
74
+ enable-cache: true
75
+ python-version: "3.11"
76
+
77
+ - run: uv run --isolated --resolution lowest-direct --group dev pytest
78
+
79
+ # The built package must be valid, render on PyPI, and import from a clean environment.
80
+ build:
81
+ runs-on: ubuntu-latest
82
+ steps:
83
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
84
+ with:
85
+ persist-credentials: false
86
+
87
+ - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
88
+ with:
89
+ version: "0.11.26" # keep in sync with release.yml
90
+
91
+ - run: uv build
92
+ - run: uvx twine check --strict dist/*
93
+ - run: uv run --isolated --no-project --with dist/*.whl python -c "import databricks_external_access"
94
+
95
+ # The one check branch protection requires (see the infrastructure repo). It has a stable name
96
+ # so changing the jobs or the test matrix above never needs an infrastructure change.
97
+ # `always()` makes it report even when a job failed or was cancelled; it then fails unless
98
+ # EVERY job's result is exactly `success` (anything else, including skipped or cancelled, fails).
99
+ ci-required:
100
+ if: always()
101
+ needs: [lint, test, test-lowest, build]
102
+ runs-on: ubuntu-latest
103
+ env:
104
+ RESULTS: ${{ join(needs.*.result, ' ') }}
105
+ steps:
106
+ - name: Fail unless every CI job succeeded
107
+ run: |
108
+ echo "Job results: $RESULTS"
109
+ for result in $RESULTS; do [ "$result" = success ] || exit 1; done
@@ -0,0 +1,106 @@
1
+ name: Release
2
+
3
+ # Pushing a tag `vX.Y.Z` from main builds the package, publishes a GitHub Release, and publishes
4
+ # to PyPI (see CONTRIBUTING.md). Run it by hand (Actions > Release > Run workflow) for a dry run:
5
+ # the same checks and build, publishing nothing. Tick `testpypi` to also upload the build to
6
+ # TestPyPI. Do a dry run before tagging, because release tags cannot be undone.
7
+
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+ workflow_dispatch:
12
+ inputs:
13
+ testpypi:
14
+ description: Also upload the build to TestPyPI (once per version; files are immutable)
15
+ type: boolean
16
+ default: false
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ build:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ fetch-depth: 0
28
+ persist-credentials: false
29
+
30
+ - uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
31
+ with:
32
+ version: "0.11.26" # keep in sync with ci.yml
33
+
34
+ - name: Check the tag is on main and matches the package version
35
+ run: |
36
+ version="$(uv version --short --frozen)"
37
+ if [ "$GITHUB_REF_TYPE" = tag ]; then
38
+ git merge-base --is-ancestor "$GITHUB_SHA" origin/main \
39
+ || { echo "::error::$GITHUB_REF_NAME is not on main"; exit 1; }
40
+ [ "v$version" = "$GITHUB_REF_NAME" ] \
41
+ || { echo "::error::tag $GITHUB_REF_NAME does not match pyproject version v$version"; exit 1; }
42
+ else
43
+ echo "Dry run on $GITHUB_REF_NAME: would release v$version"
44
+ fi
45
+ echo "VERSION=$version" >> "$GITHUB_ENV"
46
+
47
+ # The release notes are this version's section of CHANGELOG.md, so the changelog stays the
48
+ # single source of truth and a release cannot go out without one.
49
+ - name: Extract the release notes from CHANGELOG.md
50
+ run: |
51
+ awk -v v="$VERSION" '/^## \[/ { in_section = index($0, "[" v "]") > 0; next } in_section' \
52
+ CHANGELOG.md > notes.md
53
+ [ -s notes.md ] || { echo "::error::CHANGELOG.md has no section for $VERSION"; exit 1; }
54
+ cat notes.md
55
+
56
+ - run: uv build
57
+ - run: uvx twine check --strict dist/*
58
+
59
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
60
+ with:
61
+ name: release
62
+ path: |
63
+ dist/
64
+ notes.md
65
+ if-no-files-found: error
66
+
67
+ github-release:
68
+ needs: build
69
+ if: github.ref_type == 'tag'
70
+ runs-on: ubuntu-latest
71
+ permissions:
72
+ contents: write # create the GitHub Release
73
+ steps:
74
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
75
+ with:
76
+ name: release
77
+ path: release
78
+
79
+ - name: Create the release
80
+ env:
81
+ GH_TOKEN: ${{ github.token }}
82
+ run: >
83
+ gh release create "$GITHUB_REF_NAME" release/dist/*
84
+ --repo "$GITHUB_REPOSITORY" --verify-tag --title "$GITHUB_REF_NAME"
85
+ --notes-file release/notes.md
86
+
87
+ # A tag publishes to PyPI; a manual run with `testpypi` ticked publishes to TestPyPI instead.
88
+ # Authentication is PyPI "trusted publishing" (GitHub's OIDC identity): no token or secret is
89
+ # stored anywhere. Both indexes are configured with this workflow and the `pypi` environment.
90
+ publish:
91
+ needs: build
92
+ if: github.ref_type == 'tag' || inputs.testpypi
93
+ runs-on: ubuntu-latest
94
+ environment: pypi
95
+ permissions:
96
+ id-token: write # trusted publishing
97
+ steps:
98
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
99
+ with:
100
+ name: release
101
+ path: release
102
+
103
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
104
+ with:
105
+ packages-dir: release/dist
106
+ repository-url: ${{ github.ref_type == 'tag' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .venv/
4
+ dist/
5
+ build/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .coverage
9
+ coverage.xml
10
+ .DS_Store
11
+ data/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project follows
5
+ [Semantic Versioning](https://semver.org/) (while `0.x`, a breaking change bumps the minor
6
+ version).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.1] - 2026-11-25
11
+
12
+ ### Added
13
+
14
+ - Published on PyPI: `pip install databricks-external-access`. There are no code changes since
15
+ 0.1.0.
16
+
17
+ ## [0.1.0] - 2026-11-24
18
+
19
+ First release.
20
+
21
+ ### Added
22
+
23
+ - Browse Unity Catalog: `overview()`, `catalogs()`, `schemas()`, `tables()`, `describe()`.
24
+ - `fetch()` a table or a slice (`columns`, `where`, `limit`) to a local Parquet file, printing
25
+ its size on storage first. Reads Lakeflow pipeline tables (`deletionVectors`,
26
+ `v2Checkpoint`, `columnMapping`) through temporary table credentials and DuckDB.
27
+ - `login()` to save the workspace once and sign in through the browser (SSO).
28
+ - Actionable, catchable errors: `NotSignedIn`, `AccessDenied`, `NotFound` and `UnsupportedTable`,
29
+ all subclasses of `Error`.
30
+ - `__version__`.
31
+ - Requirements and design documentation (`docs/`).
@@ -0,0 +1,98 @@
1
+ # Contributing
2
+
3
+ Thanks for helping. Bug reports, fixes, docs and features are all welcome; for anything
4
+ larger than a small fix, please open an issue first so we can agree on the approach.
5
+
6
+ ## Setup and checks
7
+
8
+ Requires [uv](https://docs.astral.sh/uv/) and [just](https://github.com/casey/just).
9
+
10
+ ```bash
11
+ just sync # install dependencies
12
+ just lint # ruff, ruff format, basedpyright
13
+ just test # pytest with coverage
14
+ ```
15
+
16
+ CI runs the same checks on every pull request (the aggregate `ci-required` job passes only when all
17
+ of them do, and is the single check meant for branch protection): lint and types, the tests on Linux, macOS and
18
+ Windows with Python 3.11 and 3.13, the tests against the **lowest** dependency versions that
19
+ `pyproject.toml` allows, and a build check (`twine check`, clean-environment import).
20
+
21
+ ### The integration test
22
+
23
+ `tests/test_integration.py` reads real tables from a real workspace. It runs when
24
+ `DATABRICKS_TEST_TABLES` (comma-separated `catalog.schema.table`; include a Lakeflow streaming
25
+ table written by `apply_changes` and a materialized view) is set and you have run
26
+ `databricks_external_access.login(...)` before, and skips itself otherwise, including in CI,
27
+ which has no sign-in. Run it before changing anything in `fetch.py` and when
28
+ bumping `duckdb` or `databricks-sdk`: it is what catches a client no longer reading Lakeflow
29
+ tables.
30
+
31
+ ## Where things are
32
+
33
+ - [docs/requirements.md](docs/requirements.md): what the project must do and the conditions it
34
+ works under. A change that alters a requirement updates it in the same pull request.
35
+ - [docs/design.md](docs/design.md): how it works, the module map, decisions, and where to extend.
36
+
37
+ ## Design rules
38
+
39
+ - **Lean.** The package has two runtime dependencies (`databricks-sdk`, `duckdb`); adding a
40
+ third needs a strong case. Delete rather than deprecate, and no options kept "just in case".
41
+ - **One source of truth.** No logic or constant maintained in two places.
42
+ - **Docs move with the code.** README, docstrings, comments and `CHANGELOG.md` (under
43
+ `[Unreleased]`) must be correct in the same pull request.
44
+ - **Never print or log credentials.**
45
+
46
+ ## Pull requests
47
+
48
+ 1. Fork the repository (or branch, if you are a maintainer) and branch off `main` using
49
+ `feature/…`, `fix/…`, `docs/…` or `chore/…`.
50
+ 2. Open a pull request against `main`. Branches are merged by **squash**, so the pull request
51
+ title becomes the commit message: make it a short imperative summary.
52
+ 3. A code owner must approve before merging (`.github/CODEOWNERS`); other reviews are welcome
53
+ but do not satisfy the merge rule. An author cannot approve their own pull request, so a
54
+ code owner should not open the pull request they are meant to approve.
55
+
56
+ ## Releasing
57
+
58
+ Releases are tags on `main`; consumers pin a tag. Tags matching `v*` are protected: they
59
+ cannot be moved or deleted except by organisation admins, so check before you tag, and never
60
+ reuse a version.
61
+
62
+ 1. In a pull request, bump `version` in `pyproject.toml`, run `uv lock` (CI uses `--locked`),
63
+ and in `CHANGELOG.md` move the `[Unreleased]` entries under the new version with its date.
64
+ Merge it.
65
+ 2. Dry-run the release: Actions > **Release** > Run workflow, on `main`. It performs the same
66
+ checks and build as a real release but publishes nothing (tick `testpypi` to also upload the
67
+ build to TestPyPI, once per version). Fix anything it reports; tags cannot be undone, so do
68
+ not skip this.
69
+ 3. A maintainer tags the merge commit and pushes the tag:
70
+
71
+ ```bash
72
+ git switch main && git pull
73
+ git tag -a vX.Y.Z -m "vX.Y.Z"
74
+ git push origin vX.Y.Z
75
+ ```
76
+
77
+ 4. The `Release` workflow checks that the tag is on `main` and equals the `pyproject.toml`
78
+ version, builds the package, publishes a GitHub Release (that version's `CHANGELOG.md` section
79
+ as the notes, wheel and sdist attached; it fails if the changelog has no section for the
80
+ version), and publishes to PyPI.
81
+ 5. Consumers bump their pin to the new version.
82
+
83
+ ### Publishing to PyPI
84
+
85
+ The `Release` workflow already publishes to PyPI on a tag, using PyPI **trusted publishing**
86
+ (GitHub's OIDC identity), so no token or secret is stored anywhere. It needs these one-time
87
+ settings first, so **do not push a release tag until they exist** (the publish job would fail):
88
+
89
+ 1. A PyPI project owner (with 2FA) adds a **pending trusted publisher** at
90
+ <https://pypi.org/manage/account/publishing/>: owner `Northbridge-Capital`, repository
91
+ `databricks-external-access`, workflow `release.yml`, environment `pypi`. Do the same on
92
+ <https://test.pypi.org> to use the `testpypi` dry run. The first publish creates the project.
93
+ 2. A GitHub environment named `pypi` on this repository, managed in the infrastructure
94
+ repo's Terraform (ideally with a required reviewer, so each publish needs one approval).
95
+
96
+ PyPI files are immutable: a version can be uploaded exactly once, so a release that fails
97
+ after upload needs a new version. Once published, the README's install command can change to
98
+ `pip install databricks-external-access`.
@@ -0,0 +1,19 @@
1
+ # Use PowerShell on Windows so recipes work in CMD, PowerShell, and Git Bash
2
+ set windows-shell := ["powershell.exe", "-NoProfile", "-Command"]
3
+
4
+ default:
5
+ @just --list
6
+
7
+ # Install dependencies into .venv
8
+ sync:
9
+ uv sync
10
+
11
+ # Format, lint and type-check
12
+ lint:
13
+ uv run ruff check . --fix
14
+ uv run ruff format .
15
+ uv run basedpyright
16
+
17
+ # Unit tests with coverage
18
+ test:
19
+ uv run pytest --cov --cov-report=term-missing
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Northbridge Capital
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.5
2
+ Name: databricks-external-access
3
+ Version: 0.1.1
4
+ Summary: Browse Databricks Unity Catalog and fetch tables to local Parquet files, no Databricks compute needed
5
+ Project-URL: Homepage, https://github.com/Northbridge-Capital/databricks-external-access
6
+ Project-URL: Source, https://github.com/Northbridge-Capital/databricks-external-access
7
+ Project-URL: Issues, https://github.com/Northbridge-Capital/databricks-external-access/issues
8
+ Project-URL: Changelog, https://github.com/Northbridge-Capital/databricks-external-access/blob/main/CHANGELOG.md
9
+ Author: Northbridge Capital
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: databricks,delta-lake,duckdb,parquet,unity-catalog
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: databricks-sdk>=0.169
25
+ Requires-Dist: duckdb>=2.0
26
+ Description-Content-Type: text/markdown
27
+
28
+ # databricks-external-access
29
+
30
+ [![CI](https://github.com/Northbridge-Capital/databricks-external-access/actions/workflows/ci.yml/badge.svg)](https://github.com/Northbridge-Capital/databricks-external-access/actions/workflows/ci.yml)
31
+
32
+ Browse a Databricks workspace (Unity Catalog) and fetch tables to your own machine as Parquet,
33
+ with no Databricks compute and no secrets. Sign in once through your workspace's SSO.
34
+
35
+ ```python
36
+ import databricks_external_access as dbx
37
+
38
+ dbx.login("https://dbc-1234abcd-5678.cloud.databricks.com") # once per machine
39
+
40
+ dbx.overview() # everything you can see, as a tree
41
+ dbx.describe("main.sales.orders") # columns and descriptions
42
+
43
+ path = dbx.fetch(
44
+ "main.sales.orders",
45
+ columns=["order_date", "customer", "total"],
46
+ where="customer = 'ACME'",
47
+ limit=1_000_000,
48
+ )
49
+ # stderr: main.sales.orders: 2 Parquet files, 51.5 MiB on storage ...
50
+
51
+ import polars as pl # or pandas, DuckDB, Spark, ...
52
+
53
+ df = pl.read_parquet(path)
54
+ ```
55
+
56
+ New here? Open the
57
+ [tutorial notebook](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/notebooks/tutorial.ipynb)
58
+ (`uv run --group notebook jupyter lab`).
59
+
60
+ **Status: alpha (`0.x`).** The API may change between minor versions; see the
61
+ [changelog](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/CHANGELOG.md).
62
+ It is installed from git tags for now; publishing to PyPI is planned.
63
+
64
+ ## Setup
65
+
66
+ 1. Install a pinned release (see the repository's Releases page for the latest tag):
67
+
68
+ ```bash
69
+ uv add "databricks-external-access @ git+https://github.com/Northbridge-Capital/databricks-external-access@v0.1.0"
70
+ # or: pip install "databricks-external-access @ git+https://github.com/Northbridge-Capital/databricks-external-access@v0.1.0"
71
+ ```
72
+
73
+ 2. Run `dbx.login("https://<your-workspace>.cloud.databricks.com")` once. A browser opens to
74
+ sign in through your workspace's SSO; the workspace is remembered and the token is cached and
75
+ refreshed automatically. Scripts and CI can set `DATABRICKS_HOST` instead, which overrides the
76
+ saved workspace.
77
+
78
+ Requires Python 3.11+, an AWS workspace and internet access (DuckDB downloads two extensions on
79
+ first use). To fetch a table you need `SELECT` on it **and** `EXTERNAL USE SCHEMA` on its schema;
80
+ this package never manages grants, so ask your Databricks admin. The full list of requirements
81
+ and constraints is in
82
+ [docs/requirements.md](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/docs/requirements.md).
83
+
84
+ ## API
85
+
86
+ | Function | Returns |
87
+ |---|---|
88
+ | `login("https://...")` | nothing; saves the workspace and signs in (once per machine) |
89
+ | `overview(catalog=None)` | nothing; prints catalogs, schemas and tables as a tree (skips `system`, `samples` and `information_schema` unless you name the catalog) |
90
+ | `catalogs()` | `list[Entry]`: name, comment |
91
+ | `schemas("catalog")` | `list[Entry]`, named `catalog.schema` |
92
+ | `tables("catalog.schema")` | `list[Table]`: name, kind, comment, `columns` (name, type, comment) |
93
+ | `describe("catalog.schema.table")` | one `Table` |
94
+ | `fetch("catalog.schema.table", columns=, where=, limit=, dest="data")` | `Path` to `<dest>/<name>.parquet` |
95
+
96
+ `fetch` prints the table's size on storage to stderr **before** reading any data; for a slice
97
+ this is the whole table, an upper bound. `where` is a DuckDB SQL predicate that runs on your
98
+ machine with your own credentials and is not sanitised. A failed fetch leaves no partial file.
99
+
100
+ ## Errors
101
+
102
+ Everything raises a subclass of `databricks_external_access.Error`, with a message that says what
103
+ to do:
104
+
105
+ | Error | Raised when |
106
+ |---|---|
107
+ | `NotSignedIn` | Databricks rejects your sign-in; delete the token cache and retry |
108
+ | `AccessDenied` | you lack `SELECT` or `EXTERNAL USE SCHEMA` |
109
+ | `UnsupportedTable` | views, shared (Delta Sharing), foreign and non-Delta tables, non-AWS workspaces, and pipeline tables whose pipeline has not enabled `pipelines.externalMetadata.enabled` |
110
+ | `NotFound` | the table does not exist, or you cannot see it |
111
+ | `Error` | anything else actionable, such as no workspace configured or an `http://` URL |
112
+
113
+ ## More
114
+
115
+ - [Requirements](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/docs/requirements.md):
116
+ what it must do, the conditions it works under, what is out of scope, and how each is verified.
117
+ - [Design](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/docs/design.md):
118
+ how it works, why DuckDB, trade-offs, and where to extend it.
119
+ - [Contributing](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/CONTRIBUTING.md):
120
+ setup, checks and the release process.
121
+
122
+ ## License
123
+
124
+ MIT, see
125
+ [LICENSE](https://github.com/Northbridge-Capital/databricks-external-access/blob/main/LICENSE).