fix(notebooks): api_explorer target URL + zotero_tutorial polars schema inference
All checks were successful
CI / lint (push) Successful in 29s
CI / notebooks-smoke (push) Successful in 1m24s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / notebooks (push) Successful in 48s
Infra CI / zotero (push) Successful in 12s
Infra CI / docs (push) Successful in 12s
Infra CI / api (push) Successful in 17s
Infra CI / mc (push) Successful in 21s
Deploy / report (push) Successful in 14s
CI / test (push) Successful in 16m35s

- api_explorer pointed at http://localhost:8080 — a host-side dev
  server that never exists inside the notebooks container (nb issue
  #546 alongside the api service wedge). Now defaults to the compose
  service http://api:8000, overridable via STACK_API_URL.
- zotero_tutorial's CASE/GROUP_CONCAT queries can yield columns that
  are all-NULL within polars' default inference window with strings
  appearing later ('could not append value', nb issue #561 — surfaced
  once the immutable=1 fix got reads past the lock). Pin
  infer_schema_length=None on all read_database calls.

Verified headless in the prod container: both notebooks now export
with zero cell errors.
This commit is contained in:
kert
2026-07-10 14:17:16 -04:00
parent 81dba5ef2a
commit e8f6385bc5
2 changed files with 12 additions and 2 deletions

View File

@@ -14,16 +14,20 @@ def _():
Interactive test harness for the Stack REST API. Exercises every endpoint Interactive test harness for the Stack REST API. Exercises every endpoint
group: **health**, **pipelines**, **lineage**, **bib**, **schema**, and **auth**. group: **health**, **pipelines**, **lineage**, **bib**, **schema**, and **auth**.
Start the API server first: `uv run stack api serve --port 8080` Defaults to the compose-internal `api` service; set `STACK_API_URL` to
point elsewhere (e.g. `http://localhost:8080` with a local
`uv run stack api serve --port 8080`).
""") """)
return (mo,) return (mo,)
@app.cell @app.cell
def _(): def _():
import os
import httpx import httpx
BASE = "http://localhost:8080" BASE = os.environ.get("STACK_API_URL", "http://api:8000")
client = httpx.Client(base_url=BASE, timeout=30) client = httpx.Client(base_url=BASE, timeout=30)
return (client,) return (client,)

View File

@@ -117,6 +117,7 @@ def _(db, mo, pl):
ORDER BY c.collectionName ORDER BY c.collectionName
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
def _build_tree(df, parent_id=None, depth=0): def _build_tree(df, parent_id=None, depth=0):
@@ -168,6 +169,7 @@ def _(db, mo, pl):
ORDER BY count DESC ORDER BY count DESC
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
mo.ui.table( mo.ui.table(
@@ -210,6 +212,7 @@ def _(db, mo, pl):
LIMIT 25 LIMIT 25
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
mo.ui.table(recent_df, label="Recent Items") if recent_df.height > 0 else mo.md( mo.ui.table(recent_df, label="Recent Items") if recent_df.height > 0 else mo.md(
@@ -415,6 +418,7 @@ def _(db, mo, pl):
ORDER BY count DESC ORDER BY count DESC
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
mo.ui.table(tags_df, label="Tags") if tags_df.height > 0 else mo.md( mo.ui.table(tags_df, label="Tags") if tags_df.height > 0 else mo.md(
@@ -451,6 +455,7 @@ def _(db, mo, pl):
LIMIT 50 LIMIT 50
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
mo.ui.table(creators_df, label="Top Creators") if creators_df.height > 0 else mo.md( mo.ui.table(creators_df, label="Top Creators") if creators_df.height > 0 else mo.md(
@@ -502,6 +507,7 @@ def _(db, mo, pl):
ORDER BY i.dateAdded DESC ORDER BY i.dateAdded DESC
""", """,
connection=db, connection=db,
infer_schema_length=None,
) )
mo.md(f"Exported **{library_df.height}** items to `library_df`") mo.md(f"Exported **{library_df.height}** items to `library_df`")