semantic-layer
БесплатноБез исполняемых скриптовНе проверенSemantic layer reference for Keboola. Auto-loads when the user mentions: semantic layer, semantic model, SL, metastore, semantic-metric, semantic-dataset…
от keboola★ 17 звёзд на GitHubОб этом скилле
Semantic Layer — Reference
Use the commands in this plugin for structured operations:
/sl-show · /sl-validate · /sl-build
For add / edit / remove operations, work conversationally — this skill provides the full CRUD procedures below. No slash command needed.
Auth & Setup
Resolve TOKEN, STACK, and METASTORE using this fallback chain — stop at the first that works:
1. Environment variables (no kbagent needed):
import re, os
token = os.environ.get('KBC_TOKEN', '')
stack_url = os.environ.get('KBC_STACK_URL') or os.environ.get('KBC_URL', '')
if token and stack_url:
m = re.search(r'connection\.([\w-]+)\.(gcp|aws|azure)\.keboola\.com', stack_url)
region = m.group(1) if m else 'us-east4'
cloud = m.group(2) if m else 'gcp'
TOKEN = token
STACK = f'https://connection.{region}.{cloud}.keboola.com'
METASTORE = f'https://metastore.{region}.{cloud}.keboola.com'
2. kbagent config file (if kbagent is installed):
import json, re, os
cfg_path = os.path.expanduser('~/Library/Application Support/keboola-agent-cli/config.json')
if os.path.exists(cfg_path):
cfg = json.load(open(cfg_path))
for alias in sorted(cfg['projects']): print(alias) # list for user to pick
p = cfg['projects'][PROJECT] # PROJECT = alias chosen by user from list above
m = re.search(r'connection\.([\w-]+)\.(gcp|aws|azure)\.keboola\.com', p['stack_url'])
region = m.group(1) if m else 'us-east4'
cloud = m.group(2) if m else 'gcp'
TOKEN = p['token']
STACK = f'https://connection.{region}.{cloud}.keboola.com'
METASTORE = f'https://metastore.{region}.{cloud}.keboola.com'
3. Ask the user (fallback when neither above works): Ask for:
- Storage API token — Keboola UI → Settings → API Tokens
- Connection URL — e.g.
connection.europe-west3.gcp.keboola.com
Derive STACK and METASTORE from the region and cloud in the connection URL.
Once resolved: H = {'X-StorageAPI-Token': TOKEN, 'Content-Type': 'application/json'}
kbagent is not required for CRUD operations or
/sl-show//sl-validate. It is only needed for/sl-build(schema + SQL discovery) and/sl-validate --deep(phantom-field checks against Snowflake).
API Primitives
import urllib.request, json
def api_get(path):
req = urllib.request.Request(f"{METASTORE}{path}", headers={'X-StorageAPI-Token': TOKEN})
return json.loads(urllib.request.urlopen(req, timeout=15).read()).get('data', [])
def api_post(path, body):
req = urllib.request.Request(
f"{METASTORE}{path}", json.dumps(body).encode(), H, method='POST')
with urllib.request.urlopen(req, timeout=30) as r:
return json.loads(r.read())
def api_patch(path, body):
req = urllib.request.Request(
f"{METASTORE}{path}", json.dumps(body).encode(), H, method='PATCH')
with urllib.request.urlopen(req, timeout=30) as r:
return json.loads(r.read())
def api_delete(path):
req = urllib.request.Request(f"{METASTORE}{path}", headers=H, method='DELETE')
urllib.request.urlopen(req, timeout=15)
def db_name():
"""Resolve Snowflake DB for the current project: KEBOOLA_<projectId>.
Caches to /tmp/sl_db_name.txt for the run. Falls back to 'KEBOOLA' on failure."""
import sys
cache = '/tmp/sl_db_name.txt'
if os.path.exists(cache):
return open(cache).read().strip()
try:
req = urllib.request.Request(f"{STACK}/v2/storage/tokens/verify",
headers={'X-StorageApi-Token': TOKEN})
pid = json.loads(urllib.request.urlopen(req, timeout=15).read())['owner']['id']
name = f'KEBOOLA_{pid}'
except Exception as e:
print(f"⚠ db_name resolve failed ({e}); falling back to KEBOOLA", file=sys.stderr)
name = 'KEBOOLA'
open(cache, 'w').write(name)
return name
Endpoints:
GET /api/v1/repository/{type} → {"data": [...]}
POST /api/v1/repository/{type} → {"data": {item}}
PATCH /api/v1/repository/{type}/{id} → {"data": {item}} # in-place update
DELETE /api/v1/repository/{type}/{id}
Types: semantic-model · semantic-dataset · semantic-metric ·
semantic-relationship · semantic-glossary · semantic-constraint
Filtering by model: use i.get('attributes', {}).get('modelUUID') == UUID
on the returned list — the ?modelId query param is unreliable.
POST envelope (all types except semantic-model):
{
"name": "<item name or term>",
"data": { ...item fields..., "modelUUID": "<UUID>" },
"branch": "main",
"schemaVersion": "1.0.0",
"scope": "project"
}
POST envelope for semantic-model:
{
"name": "<model name>",
"data": { "name": "<model name>", "description": "...", "sql_dialect": "Snowflake" },
"branch": "main",
"schemaVersion": "1.0.0",
"scope": "project"
}
Payload Shapes
semantic-dataset
{
"name": "fa
Установить semantic-layer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл semantic-layer?
Semantic layer reference for Keboola. Auto-loads when the user mentions: semantic layer, semantic model, SL, metastore, semantic-metric, semantic-dataset, semantic-relationship, semantic-glossary, semantic-constraint, inspect model, validate model, threshold constraints, metric sql, model entities, add dataset, create metric, update metric, delete metric, remove constraint. Provides API reference, payload shapes, CRUD procedures, validation rules, and operational gotchas so Claude can work with the metastore directly.
Как установить скилл semantic-layer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл semantic-layer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic