Repository navigation
feat(session/metadata/pyo3): attach async statement by id, case-insensitive table_types, SEA error envelope, num_modified_rows #114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2026 Databricks, Inc. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # PyO3 sub-crate CI. Path-gated on `pyo3/**` so this workflow | |
| # only fires when the directory exists (it lands in PR #13). The | |
| # job is skipped automatically on every PR that doesn't touch | |
| # the pyo3/ tree. | |
| name: PyO3 Checks | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "pyo3/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - ".github/workflows/pyo3-checks.yml" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "pyo3/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - ".github/workflows/pyo3-checks.yml" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| # Required for the OIDC token exchange that the | |
| # `.github/actions/setup-jfrog` composite uses to authenticate | |
| # against the JFrog cargo + pip proxies. See go/hardened-gha. | |
| id-token: write | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # Cheap gate job — runs once, no matrix, no toolchain installs. | |
| # The matrix `build-and-test` job depends on this and is skipped | |
| # entirely (no runner boot, no checkout) when the pyo3/ sub-crate | |
| # doesn't exist. This avoids the per-Python-version setup cost on | |
| # kernel-only PRs that trigger this workflow via root Cargo.toml | |
| # / Cargo.lock changes. | |
| precondition: | |
| name: "Check pyo3 sub-crate exists" | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| outputs: | |
| ready: ${{ steps.check.outputs.ready }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: "Check for pyo3/Cargo.toml" | |
| id: check | |
| run: | | |
| if [[ -f "pyo3/Cargo.toml" ]]; then | |
| echo "ready=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "::notice::pyo3/ sub-crate does not exist yet — skipping pyo3 build/test matrix. (Workflow fires on root Cargo.toml changes; the pyo3 sub-crate lands in PR #13.)" | |
| echo "ready=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| build-and-test: | |
| name: "PyO3 build + test (Python ${{ matrix.python-version }})" | |
| needs: precondition | |
| if: needs.precondition.outputs.ready == 'true' | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| # `azure-prod` holds the Databricks secrets used by the live | |
| # pytest suite below. Fork PRs are paused at "Waiting / approval | |
| # required" until a maintainer clicks through, preventing secret | |
| # exfil. PRs from forks that don't get approval still run the | |
| # cargo-test step (no secrets needed) but the pytest step skips | |
| # the `@live`-marked tests automatically when env vars are unset. | |
| environment: azure-prod | |
| env: | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_HTTP_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| RUST_LOG: databricks_sql_kernel=info | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Cover the supported floor through the newest release. 3.13 | |
| # and 3.14 exercise the GIL / free-threading changes where | |
| # PyO3 extensions most often break. Floor is 3.10 — matches | |
| # `requires-python` in pyo3/pyproject.toml. | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-jfrog | |
| with: | |
| cargo: "true" | |
| uv: "true" | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1 | |
| # uv is the Python package manager the kernel pyo3 sub-crate | |
| # uses for env management. uv itself is installed via | |
| # astral-sh/setup-uv (SHA-pinned) rather than via | |
| # `pip install uv` so the bootstrap is also hash-locked. | |
| - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| with: | |
| # Pin uv to a known good version; bump deliberately. | |
| version: "0.11.14" | |
| - name: Install dev dependencies (uv sync) | |
| # No `--frozen` and no committed lockfile: per go/pinning- | |
| # python-deps the externally-published-library rule says | |
| # *not* to pin transitive deps (it impedes downstream | |
| # `pip install`). The `[project].dependencies` major-version | |
| # bounds in `pyproject.toml` plus the JFrog proxy's 7-day | |
| # age filter on `db-pypi` are the baseline protection. uv | |
| # re-resolves each run within those bounds. | |
| working-directory: pyo3 | |
| # `--no-install-project` installs only the dependency groups, | |
| # NOT the kernel cdylib itself. Without it, `uv sync` runs a | |
| # full maturin/cargo RELEASE build of the extension here — and | |
| # then the `maturin develop` step below rebuilds it again in | |
| # debug, so the kernel compiled twice per matrix Python version | |
| # (~5 min each, x5 versions). The Rust extension is built | |
| # exactly once, by `maturin develop`. | |
| run: uv sync --group dev --no-install-project | |
| - name: Cargo unit tests (pyo3 crate) | |
| # The pyo3 crate's Rust-side unit tests cover the GIL handoff | |
| # in isolation. Runs before any maturin build so a pure-Rust | |
| # break is caught fast. | |
| # | |
| # pyo3 is a standalone workspace (see `pyo3/Cargo.toml`), so | |
| # `cargo test` runs from inside `pyo3/` rather than via | |
| # `-p` from the kernel root. Same reason as napi: per-binding | |
| # TLS feature choice cannot share a workspace with the kernel | |
| # default. | |
| working-directory: pyo3 | |
| run: cargo test | |
| - name: "Build + install pyo3 wheel (maturin develop)" | |
| working-directory: pyo3 | |
| # `develop` builds the extension and installs it into the | |
| # uv-managed venv from the previous step. Debug build is | |
| # fine for tests and ~2x faster than --release. | |
| # | |
| # maturin's `develop` always targets the active virtualenv's | |
| # interpreter and (unlike `build`) has no --interpreter flag; | |
| # `uv run` already activates the venv `uv sync` created for the | |
| # matrix Python version, so the interpreter is selected for us. | |
| run: uv run maturin develop | |
| - name: pytest (no-network + live tiers) | |
| working-directory: pyo3 | |
| # `conftest.py` decorates the warehouse-bound tests with | |
| # `@live`; they auto-skip when DATABRICKS_HOST/HTTP_PATH/ | |
| # TOKEN are unset. With the env: block above the live tier | |
| # runs against the configured warehouse on PRs from this | |
| # repo; on fork PRs without approval, the no-network tier | |
| # (test_module.py + test_auth.py) runs and the live tier | |
| # skips cleanly. | |
| run: uv run pytest -v |