spanner-relational-to-graph
БесплатноБез исполняемых скриптовНе проверенAnalyzes existing Spanner relational schemas on Google Cloud (DDL, foreign keys, interleaved tables, and junction tables) and generates `CREATE PROPERTY…
от google★ 25 380 звёзд на GitHubОб этом скилле
Spanner Relational-to-Property-Graph Schema Conversion
Convert an existing Spanner relational schema into a valid, production-ready
CREATE OR REPLACE PROPERTY GRAPH DDL definition while keeping existing
relational tables intact.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST
read and follow the instructions in
Usage Attribution.
Prerequisites & Cloud Environment Setup
When inspecting a live Spanner instance or verifying DDL (see spanner-basics
for general Spanner instance provisioning and MCP setup):
- Google Cloud SDK (
gcloud): Ensure the CLI is installed (see Install the Google Cloud SDK). - Project, Billing & API: Verify an active Google Cloud project with
billing enabled (required even when provisioning a free trial instance) is
configured (
gcloud config set project {project_id}) and, after the user confirms, enable the Spanner API (gcloud services enable spanner.googleapis.com). Ask the user before changing the active project, billing, or enabled APIs, or creating or deleting instances, because these commands change the user's Google Cloud environment and can incur costs. - Authentication & IAM Roles: Authenticate via
gcloud auth loginorgcloud auth application-default login(orGOOGLE_APPLICATION_CREDENTIALSfor service accounts). Listing instances/databases requiresroles/spanner.viewer, inspecting DDL requiresroles/spanner.databaseReader, and applyingCREATE VIEW/CREATE PROPERTY GRAPHDDL requiresroles/spanner.databaseAdmin. - Instance Region & Pricing: For sandbox test instances, default to
regional-us-central1unless specified otherwise (see Spanner instance configurations, Google Cloud locations, Spanner pricing, and Google Cloud pricing).
Core Principles
- Zero Data Duplication: Spanner Graph maps existing relational tables or
SQL views directly into graph nodes and edges via
CREATE PROPERTY GRAPHmetadata—without copying data or breaking existing SQL applications. - Preserve Existing Tables: Treat all existing relational tables as
read-only inputs. Do not drop, rename, or alter existing columns or primary
keys when adding a property graph view. If an implicit relationship requires
key transformation (for example, unnesting an array or casting mismatched key
types), define a new SQL bridge view
(
CREATE VIEW ... SQL SECURITY INVOKER AS ...by default, orSQL SECURITY DEFINERwhen row-level access control is needed) and bind the edge or node to that view. - 100% Table Accounting: Account for every relational table in the input
schema—either mapped into
NODE TABLES/EDGE TABLESor explicitly listed as excluded (such as pure system audit logs, schema migration state tables, or unlinked lookup tables).
Step-by-Step Conversion Workflow
Step 1: Discover or Parse the Relational Schema
If the user provides DDL statements in the prompt, parse all
CREATE TABLE,PRIMARY KEY,INTERLEAVE IN PARENT, andFOREIGN KEYdefinitions directly.If the user provides a live Spanner instance and database ID (or a Google Cloud Console URL containing
instances/{instance_id}/databases/{database_id}?project={project_id}), extractproject,instance, anddatabaseand retrieve the live DDL using the read-onlygcloudcommand:gcloud spanner databases ddl describe {database_id} \ --instance={instance_id} \ --project={project_id}- Live-Database Safety Rule:
gcloud spanner databases ddl describeis read-only and safe to run automatically, whereas applyingCREATE VIEWorCREATE OR REPLACE PROPERTY GRAPHviagcloud spanner databases ddl updatemutates the live database—always ask for explicit user confirmation before runninggcloud spanner databases ddl update(and state this confirmation requirement clearly in your response even ifddl describefails due to missing credentials or network access). - See references/cloud-spanner-guide.md for environment discovery, emulator setup, and verification workflows.
- Live-Database Safety Rule:
Step 2: Classify Relational Tables into Nodes and Edges
Apply the structural classification rules in references/patterns.md:
- Core Entity Tables ->
NODE TABLES:- Tables representing domain nouns (
Users,Accounts,Products,Devices,Documents) become node tables. - Use the table's full
PRIMARY KEYas the nodeKEY (...).
- Tables representing domain nouns (
- **Pure or Attributed M:N Junction Tables -> `ED
Установить spanner-relational-to-graph в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл spanner-relational-to-graph?
Analyzes existing Spanner relational schemas on Google Cloud (DDL, foreign keys, interleaved tables, and junction tables) and generates `CREATE PROPERTY GRAPH` DDL statements (`NODE TABLES`, `EDGE TABLES`) without modifying underlying relational tables. Use when mapping existing Spanner tables to a Spanner Graph, identifying node and edge candidates from relational tables, creating SQL bridge views for implicit `ARRAY`/`JSON` or type-mismatched relationships, mapping polymorphic or self-referential tables, or troubleshooting `CREATE PROPERTY GRAPH` DDL compiler errors. Don't use for greenfield physical table design (use spanner-graph-schema-best-practices) or tuning slow ISO GQL queries (use spanner-graph-query-tuning).
Как установить скилл spanner-relational-to-graph?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spanner-relational-to-graph запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic