Skip to content

docs(mdcode): codelab deploys to Spanner via a binding profile - #364

Merged
libei merged 10 commits into
GoogleCloudPlatform:mainfrom
libei:docs/codelab-profiles-spanner
Aug 30, 2026
Merged

docs(mdcode): codelab deploys to Spanner via a binding profile#364
libei merged 10 commits into
GoogleCloudPlatform:mainfrom
libei:docs/codelab-profiles-spanner

Conversation

@libei

@libei libei commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Reworks the semantic-model codelab and binding-profiles guide to show the Spanner Graph target (#361) and binding profiles (#358) working together.

Depends on #363 (now merged into main): the Spanner physical-column fix that lets remapped key/join columns deploy. This branch contains the docs commit only.

Codelab (docs/semantic-model/codelab.md)

  • Step 1 names the deployment target with the first-class deployment_target: key instead of a GOOGLE custom_extensions JSON string.
  • Section 5 replaces the sed deployment-target swap with a real binding profile (sales.profiles/operational.yaml): a Spanner store with different table names, remapped columns (including keys), and an unbound net_amount so revenue is withheld operationally. It shows kcmd profiles' availability report, the generated Spanner DDL, a live deploy, and a GQL query.
  • Cleanup drops the Spanner database.

Every command output in section 5 was captured from a live run against an ENTERPRISE Spanner instance.

Binding profiles (docs/semantic-model/profiles.md)

  • Scope note updated: Spanner graphs now deploy (was "non-BigQuery not yet supported").
  • Spanner sources use bare table names, not //spanner.../tables/X resource URIs (which a Spanner graph cannot reference); added a note on the rule in "Sources are URIs".
  • --target documented as bq|spanner|kc|all; command examples deploy the operational (Spanner) profile.

Why now

The codelab previously swapped backends with sed, which is exactly the manual step binding profiles remove. This makes the codelab demonstrate the feature as intended: one logical model, an analytical (BigQuery) binding and an operational (Spanner) binding, switched with --profile.

libei added 3 commits August 30, 2026 05:12
Rework codelab section 5 and update the binding-profiles guide to reflect the
Spanner Graph target (GoogleCloudPlatform#361) and binding profiles (GoogleCloudPlatform#358) together.

Codelab:
- Step 1 now names the deployment target with the first-class `deployment_target`
  key instead of a GOOGLE custom_extensions JSON string.
- Section 5 replaces the `sed` target-swap with a real Spanner binding profile
  (`sales.profiles/operational.yaml`): different table names, remapped columns
  (including keys), and an unbound `net_amount` so `revenue` is withheld
  operationally. It shows `kcmd profiles`' availability report, the generated
  Spanner DDL, a live deploy, and a GQL query -- every output captured from a
  live ENTERPRISE Spanner run. Cleanup drops the Spanner database.

profiles.md:
- Scope note updated: Spanner graphs now deploy (was "non-BigQuery not yet
  supported").
- Spanner sources use bare table names, not `//spanner.../tables/X` resource
  URIs, which a Spanner graph cannot reference; added a note on the rule.
- `--target` gains `spanner`; command examples deploy the operational (Spanner)
  profile.
Author the model as a logical model plus a named `analytical` binding
profile from the start, instead of an inline single-file binding, so the
profile feature is the default path a reader learns. Set it as
`default_profile` so steps 3-4 keep using a bare `kcmd push`; section 5
then adds the `operational` Spanner profile as a second binding rather
than introducing the concept.

Add a "simple case" callout showing the single-file inline binding (the
`default` profile) for models that only ever bind to one store.

Update the section-5 `kcmd profiles` output to show both profiles side by
side (analytical withholds nothing; operational withholds revenue).
Verified live: `kcmd profiles`, and `kcmd push --target kc|bq
--validate-only` off the split layout produce the documented output.
Reorder the codelab to match how a semantic model is actually adopted, now
that a logical-only model can be pushed to Knowledge Catalog (GoogleCloudPlatform#367):

  1. Author the logical model (no source, no column, no target)
  2. Govern it in Knowledge Catalog -- pure logical, needs no tables or data
  3. Deploy to BigQuery -- add the analytical binding, hydrate, query
  4. Deploy the same model to Spanner -- add the operational binding

The Knowledge Catalog push moves ahead of hydration and binding: it governs
meaning, so it needs neither. The analytical binding authoring and the table
hydration fold into the BigQuery step, where they are actually required. The
"why tables come first" note is rescoped to the BigQuery push, which does
validate source tables, unlike the KC push.

Deploy prose drops "...Graph" (deploy to BigQuery / to Spanner); the graph
names stay in the generated DDL, command output, and feature references. The
Spanner leg now states explicitly that Knowledge Catalog is not re-pushed --
a binding profile changes nothing logical.
@libei
libei force-pushed the docs/codelab-profiles-spanner branch from bc39cdd to 00b0501 Compare August 30, 2026 05:18
libei added 7 commits August 30, 2026 05:27
Verified the codelab end to end against live instances (Knowledge Catalog on
autopush, BigQuery, and an ENTERPRISE Spanner instance) and reconciled it with
what the commands actually print.

- Author the model and both binding profiles under `entities:` rather than
  `datasets:`, matching the prose, which calls them entities throughout. The two
  keys are aliases; the OWL-import output still shows `datasets:` (the original
  spelling) and a note points that out.
- Step 2's Knowledge Catalog plan now shows the real output: the `Validating...`
  framing, the two relationship-name-normalization warnings (with a note that
  they are expected and repeat on every KC push), and the completion footer.
- Step 3's BigQuery DDL block shows the `Pushing...` line, the `-- BigQuery
  Graph --` banner, and the deployment-target comment it was missing, matching
  the Spanner block in step 4 and the real console output.

Depends on the logical-only KC emitter fix (source.resources) so step 2's
govern-before-you-bind push succeeds against the live server.
@libei

libei commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator Author

Update: verified live, entities: throughout, and a dependency

Ran the whole codelab end to end against live instances — Knowledge Catalog on the autopush instance, live BigQuery, and a live ENTERPRISE Spanner instance. Reconciled the doc with what the commands actually print, and switched the authored YAML to entities: to match the prose.

New dependency: #368. Step 2 (govern the logical model before binding it) failed against the live server — the semantic-entity aspect template requires source.resources, but the emitter omitted the source block for a logical-only entity (Required field missing source). #367 verified this only with --validate-only, so it was never caught live. #368 fixes the emitter (source: {resources: []}); with it, kcmd push --target kc on the logical model writes all 5 entries and kcmd pull round-trips.

Doc changes in the new commit:

  • Author the model and both profiles under entities: instead of datasets: (the prose already calls them entities). The two keys are aliases; the OWL-import block still shows datasets:, and a note flags it.
  • Step 2's KC plan shows the real output: the Validating... framing, the two relationship-name-normalization warnings (with a note that they're expected and repeat on every push), and the completion footer.
  • Step 3's BigQuery DDL block shows the Pushing... line, -- BigQuery Graph -- banner, and target-URI comment it was missing — matching step 4's Spanner block and the real console.

Live results (all matched the doc after $PROJECT/$DATASET substitution): BigQuery measure query Acme 290 / Globex 40 vs. the hand-join's wrong 380 / 120; kcmd profiles withholds revenue on the operational profile; Spanner GQL returns Acme 2 / Globex 1. All test resources cleaned up afterward.

@libei
libei marked this pull request as ready for review August 30, 2026 06:13
@libei
libei merged commit 891a910 into GoogleCloudPlatform:main Aug 30, 2026
7 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