用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Snowflake-Labs/openflow-demos --skill openflow-gdrive-cleanup命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | openflow-gdrive-cleanup |
| description | Clean up the Google Drive CDC connector demo. Stops flow, drops schema, resets gate state. |
| parent_skill | openflow-gdrive-demo |
Tear down the connector deployment and reset for a fresh demo run.
Parent SKILL.md routes here on: "cleanup", "clean", "reset", "tear down", "remove"
.sfutils/manifest.toml.sfutils/manifest.toml.sfutils/ — manifest is preserved across runsThe cleanup MUST follow this dependency order:
eval $(python3 -c "
import tomllib, os
m = tomllib.load(open('.sfutils/manifest.toml', 'rb'))
s = m.get('snowflake', {})
o = m.get('openflow', {})
rt = o.get('runtime', {})
wf = o.get('workflows', {})
print(f'CONNECTION={s.get(\"connection\", \"\")}')
print(f'DATABASE={o.get(\"database\", \"\")}')
print(f'SCHEMA={o.get(\"schema\", \"\")}')
print(f'ROLE={o.get(\"role\", \"\")}')
print(f'PROFILE={rt.get(\"nipyapi_profile\", \"\")}')
print(f'EAI={o.get(\"eai\", \"\")}')
print(f'RUNTIME_FQN={rt.get(\"name\", \"\")}')
# Get PG_ID from first workflow if available
for k, v in wf.items():
if isinstance(v, dict) and v.get('pg_id'):
print(f'PG_ID={v[\"pg_id\"]}')
break
")
nipyapi --profile $PROFILE ci list_flows
Find the connector PG and get its ID. Stop the flow:
nipyapi --profile $PROFILE canvas schedule_process_group "<PG_ID>" False
nipyapi --profile $PROFILE canvas schedule_all_controllers "<PG_ID>" False
IMPORTANT: This MUST happen BEFORE deleting the process group. If the PG is deleted first, parameter contexts become orphaned and will conflict on the next deployment.
Delete in reverse-dependency order: The Ingestion context references the Destination context. Delete Ingestion first, then Destination, then any others.
Run via uv run to access the nipyapi Python dependency:
uv run --project <SKILL_DIR> python -c "
import nipyapi
nipyapi.profiles.switch('$PROFILE')
contexts = nipyapi.nifi.FlowApi().get_parameter_contexts()
# Sort: delete Ingestion before Destination (reverse dependency order)
ORDER = ['Ingestion', 'Destination', 'Connection']
matching = [ctx for ctx in contexts.parameter_contexts if 'Google Drive' in ctx.component.name]
matching.sort(key=lambda c: next((i for i, k in enumerate(ORDER) if k in c.component.name), 99), reverse=False)
for ctx in matching:
print(f'Deleting parameter context: {ctx.component.name}')
nipyapi.parameters.delete_parameter_context(ctx.id)
print(f' Deleted')
"
Where <SKILL_DIR> is the absolute path to skills/openflow-gdrive-demo/ (contains pyproject.toml with nipyapi dependency).
nipyapi --profile $PROFILE canvas delete_process_group "<PG_ID>" True
The True flag forces deletion (purges queued flowfiles).
If an EAI was attached to the runtime for this connector, ask the user to detach it via Snowsight:
Please detach EAI
{EAI_NAME}from your runtime:
- Go to Snowsight > Ingestion > OpenFlow > Deployments > your runtime
- Edit the runtime and remove
{EAI_NAME}from External Access Integrations- Save
STOP: Wait for user to confirm.
⚠️ SAFETY CHECK: Only drop the demo-specific schema. NEVER drop infrastructure schemas.
Protected schemas (NEVER drop): RUNTIMES, NETWORKS, POLICIES, INFORMATION_SCHEMA, PUBLIC
snow sql -q "DROP SCHEMA IF EXISTS $DATABASE.$SCHEMA CASCADE" -c $CONNECTION --role ACCOUNTADMIN
Removes all tables, stages, Cortex Search service, dynamic tables, and procedures in the demo schema.
If user requested full cleanup (including PAT/service-user):
<PAT_SKILL_DIR>/pat remove --user $SA_USER --db $SFUTILS_DB --drop-user --yes
snow sql -q "DROP ROLE IF EXISTS $SA_ROLE" -c $CONNECTION --role ACCOUNTADMIN
Then remove the nipyapi profile:
import yaml
profiles_path = '~/.nipyapi/profiles.yml'
# Read, delete the profile key, write back
python3 .cortex/skills/openflow-gdrive-demo/scripts/gate.py \
--step deploy --action reset --cascade --manifest .sfutils/manifest.toml
Remove [openflow], [openflow.*], and [pat.*] (if REMOVED) sections from manifest, leaving only [snowflake] and [prereqs].
Confirm no connector flow remains:
nipyapi --profile $PROFILE ci list_flows
Confirm no orphaned parameter contexts:
contexts = nipyapi.nifi.FlowApi().get_parameter_contexts()
assert len(contexts.parameter_contexts) == 0
Confirm schema is gone:
snow sql -q "SHOW SCHEMAS IN DATABASE $DATABASE" -c $CONNECTION
Confirm EAI detached (user confirmed in Step 6).
Confirm service user removed (if full cleanup):
snow sql -q "SHOW USERS LIKE '%$SA_USER%'" -c $CONNECTION --role ACCOUNTADMIN
Demo cleaned up!
Flow: Deleted
Parameter Ctxs: Deleted
EAI: Detached from runtime (integration retained)
Schema: Dropped (CASCADE)
PAT/User: [Removed | Retained]
Gate: All steps reset
Manifest: Reset to base state
Ready for fresh demo deployment
基于 SOC 职业分类