Skip to content

docs(codelab): self-contained notebook — embed artifacts instead of downloading#273

Merged
caohy1988 merged 2 commits into
GoogleCloudPlatform:mainfrom
caohy1988:docs/codelab-self-contained-artifacts
Jun 2, 2026
Merged

docs(codelab): self-contained notebook — embed artifacts instead of downloading#273
caohy1988 merged 2 commits into
GoogleCloudPlatform:mainfrom
caohy1988:docs/codelab-self-contained-artifacts

Conversation

@caohy1988
Copy link
Copy Markdown
Collaborator

Summary

Item 2 of the codelab polish: make the Colab notebook self-contained. The "Get the Codelab Artifacts" step previously curl-downloaded five files from main; it now writes the four artifacts inline from a single Python cell, so the notebook runs end-to-end with no external fetch.

  • Replaced the curl download (<!-- colab:skip --> bash + <!-- colab:cell python -->) with one <!-- colab:code python --> cell that writes table_ddl.sql, property_graph.sql, ontology.yaml, binding.yaml into the working dir. It renders in both the claat codelab and the Colab notebook.
  • Dropped the now-unused seed_events.py download (seeding uses bqaa seed-events).
  • The artifacts keep their ${PROJECT_ID} / ${DATASET} placeholders, so the existing envsubst render steps are unchanged.

Drift guard

The embedded copies were generated from the canonical files (no hand-copy), and a new test — tests/test_codelab_embedded_artifacts.py — asserts each embedded artifact stays byte-for-byte in sync with examples/codelab/periodic_materialization/. So the "embed duplicates the source" risk is caught by CI; the two can't silently diverge.

Test plan

  • tests/test_codelab_embedded_artifacts.py — 4 pass (embedded == canonical)
  • Notebook drift --check in sync; notebook has no curl
  • claat export succeeds
  • bash autoformat.sh clean

caohy1988 added 2 commits June 2, 2026 09:04
…download)

Replace the curl-from-main artifact download with a single Python cell that
writes table_ddl.sql / property_graph.sql / ontology.yaml / binding.yaml into
the working directory. The cell renders in both the claat codelab and the
Colab notebook, so the notebook now runs end-to-end with no external file
fetch (and drops the unused seed_events.py download).

A drift-guard test asserts the embedded copies stay byte-for-byte in sync with
the canonical examples/codelab/periodic_materialization/ files, so the two
sources can't silently diverge. Notebook regenerated; drift --check passes.
@caohy1988 caohy1988 merged commit 2874f71 into GoogleCloudPlatform:main Jun 2, 2026
13 checks passed
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.

1 participant