delta-sharing
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "delta-sharing":https://skillpi.com/zh/skills/deepskill-3fefcfe1427d219525d2727afca1beb29015e8dc068731da459cb8e9a68a38ad。安装前核对上游来源和版本:https://github.com/Kilo-Org/kilo-marketplace。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于 Delta Sharing 的配置、监控和接收方管理,以实现安全的跨组织数据共享。
介绍来源: third_party · Kilo-Org · 0.0.1 参考来源
SkillPi 解读
- 适合谁
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: delta-sharing
description: >-
Delta Sharing configuration, monitoring, and recipient management for secure
cross-organization data sharing.
metadata:
category: data
source:
repository: 'https://github.com/vivekgana/databricks-platform-marketplace'
path: plugins/databricks-engineering/skills/delta-sharing
license_path: LICENSE
commit: 046bffd095fb32c0726ca8c8169802916fbad5ddDelta Sharing Skill
Overview
Delta Sharing is an open protocol for secure data sharing across organizations. This skill covers share configuration, recipient management, access control, and usage monitoring.
Key Benefits:
- Secure cross-organization sharing
- No data duplication
- Real-time data access
- Centralized access control
- Usage tracking and auditing
- Open standard (works with any platform)
When to Use This Skill
Use Delta Sharing when you need to:
- Share data with external partners
- Enable cross-workspace data access
- Distribute data products to consumers
- Implement multi-tenant data access
- Track data consumption patterns
- Maintain centralized governance
Core Concepts
1. Share Configuration
Create and Configure Shares:
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
# Create share
share = w.shares.create(
name="partner_analytics_share",
comment="Analytics data for external partners"
)
# Add tables to share
w.shares.update(
name="partner_analytics_share",
updates=[
{
"action": "ADD",
"data_object": {
"name": "catalog.schema.customer_metrics",
"data_object_type": "TABLE",
"comment": "Aggregated customer metrics"
}
},
{
"action": "ADD",
"data_object": {
"name": "catalog.schema.product_sales",
"data_object_type": "TABLE"
}
}
]
)
2. Recipient Management
Create and Manage Recipients:
# Create recipient
recipient = w.recipients.create(
name="acme_corp",
comment="ACME Corporation partner",
authentication_type="TOKEN"
)
# Store the activation URL without printing it to logs or chat
from pathlib import Path
activation_file = Path.home() / ".delta-sharing" / "acme_corp.activation-url"
activation_file.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
activation_file.write_text(recipient.activation_url, encoding="utf-8")
activation_file.chmod(0o600)
print(f"Activation URL stored at: {activation_file}")
# Grant access to share
w.grants.update(
securable_type="SHARE",
securable_name="partner_analytics_share",
changes=[{
"principal": "acme_corp",
"add": ["SELECT"]
}]
)
3. Access Control
Manage Permissions:
# List current permissions
permissions = w.grants.get_effective(
securable_type="SHARE",
full_name="partner_analytics_share"
)
# Revoke access
w.grants.update(
securable_type="SHARE",
securable_name="partner_analytics_share",
changes=[{
"principal": "acme_corp",
"remove": ["SELECT"]
}]
)
# Grant access to specific tables only
w.grants.update(
securable_type="TABLE",
full_name="catalog.schema.customer_metrics",
securable_type="SHARE",
securable_name="partner_analytics_share",
changes=[{
"principal": "acme_corp",
"add": ["SELECT"]
}]
)
4. Usage Monitoring
Track Share Usage:
def monitor_share_usage(spark, share_name: str, days: int = 7):
"""Monitor Delta Sharing usage."""
query = f"""
SELECT
date_trunc('day', request_time) as date,
recipient_name,
table_name,
COUNT(*) as request_count,
SUM(rows_returned) as total_rows,
SUM(bytes_transferred) as total_bytes
FROM system.access.audit
WHERE share_name = '{share_name}'
AND request_time >= current_date() - INTERVAL {days} DAYS
GROUP BY 1, 2, 3
ORDER BY 1 DESC, 4 DESC
"""
return spark.sql(query)
# Get usage metrics
usage_df = monitor_share_usage(spark, "partner_analytics_share")
usage_df.show()
Implementation Patterns
Pattern 1: Multi-Tenant Sharing
Separate Shares per Tenant:
from pathlib import Path
class MultiTenantSharingManager:
"""Manage multi-tenant data sharing."""
def __init__(self, workspace_client: WorkspaceClient):
self.client = workspace_client
def setup_tenant_share(
self,
tenant_name: str,
tables: List[str],
tenant_email: str
):
"""Set up complete sharing for a tenant."""
share_name = f"{tenant_name}_share"
# Create share
self.client.shares.create(
name=share_name,
comment=f"Data share for {tenant_name}"
)
# Add tables
for table in tables:
self.client.shares.update(
name=share_name,
updates=[{
"action": "ADD",
"data_object": {
"name": table,
"data_object_type": "TABLE"
}
}]
)
# Create recipient
recipient = self.client.recipients.create(
name=tenant_name,
comment=f"Recipient for {tenant_name}",
authentication_type="TOKEN"
)
# Grant access
self.client.grants.update(
securable_type="SHARE",
securable_name=share_name,
changes=[{
"principal": tenant_name,
"add": ["SELECT"]
}]
)
activation_file = Path.home() / ".delta-sharing" / f"{tenant_name}.activation-url"
activation_file.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
activation_file.write_text(recipient.activation_url, encoding="utf-8")
activation_file.chmod(0o600)
return {
"share_name": share_name,
"recipient": tenant_name,
"activation_file": str(activation_file),
"tables": tables
}
Pattern 2: Row-Level Security
Implement RLS for Shared Data:
import dlt
from pyspark.sql.functions import *
@dlt.table(
name="customer_data_with_rls",
comment="Customer data with row-level security"
)
def customer_data_with_tenant_filter():
"""
Apply row-level security for multi-tenant sharing.
Each recipient sees only their tenant's data.
"""
return (
dlt.read("silver_customer_data")
.withColumn("tenant_id", col("customer_id").substr(1, 3))
.select(
"customer_id",
"tenant_id",
"customer_name",
"email",
"created_date"
)
)
# Share with partition filtering
def create_tenant_specific_share(
tenant_id: str,
source_table: str,
share_name: str
):
"""
Create share with automatic tenant filtering.
Uses partition pruning for efficient filtering.
"""
w = WorkspaceClient()
# Create view with tenant filter
view_name = f"{source_table}_{tenant_id}_view"
spark.sql(f"""
CREATE OR REPLACE VIEW {view_name} AS
SELECT * FROM {source_table}
WHERE tenant_id = '{tenant_id}'
""")
# Share the view
w.shares.create(name=share_name)
w.shares.update(
name=share_name,
updates=[{
"action": "ADD",
"data_object": {
"name": view_name,
"data_object_type": "VIEW"
}
}]
)
Pattern 3: Usage Analytics
Comprehensive Usage Tracking:
class SharingAnalytics:
"""Analyze Delta Sharing usage patterns."""
def __init__(self, spark):
self.spark = spark
def get_most_accessed_tables(self, days: int = 30):
"""Find most accessed shared tables."""
return self.spark.sql(f"""
SELECT
table_name,
COUNT(DISTINCT recipient_name) as unique_recipients,
COUNT(*) as total_requests,
SUM(rows_returned) as total_rows,
AVG(query_duration_ms) as avg_duration_ms
FROM system.access.audit
WHERE event_type = 'deltaSharing'
AND request_time >= current_date() - INTERVAL {days} DAYS
GROUP BY table_name
ORDER BY total_requests DESC
LIMIT 20
""")
def get_recipient_activity(self, recipient_name: str, days: int = 7):
"""Detailed activity for specific recipient."""
return self.spark.sql(f"""
SELECT
date_trunc('hour', request_time) as hour,
table_name,
COUNT(*) as requests,
SUM(rows_returned) as rows,
SUM(bytes_transferred) / 1024 / 1024 as mb_transferred
FROM system.access.audit
WHERE recipient_name = '{recipient_name}'
AND request_time >= current_date() - INTERVAL {days} DAYS
GROUP BY 1, 2
ORDER BY 1 DESC
""")
def detect_anomalies(self, share_name: str):
"""Detect unusual access patterns."""
return self.spark.sql(f"""
WITH daily_stats AS (
SELECT
date_trunc('day', request_time) as date,
recipient_name,
COUNT(*) as daily_requests
FROM system.access.audit
WHERE share_name = '{share_name}'
AND request_time >= current_date() - INTERVAL 30 DAYS
GROUP BY 1, 2
),
stats AS (
SELECT
recipient_name,
AVG(daily_requests) as avg_requests,
STDDEV(daily_requests) as stddev_requests
FROM daily_stats
GROUP BY recipient_name
)
SELECT
d.date,
d.recipient_name,
d.daily_requests,
s.avg_requests,
s.stddev_requests,
CASE
WHEN d.daily_requests > s.avg_requests + 2 * s.stddev_requests
THEN 'ANOMALY_HIGH'
WHEN d.daily_requests < s.avg_requests - 2 * s.stddev_requests
THEN 'ANOMALY_LOW'
ELSE 'NORMAL'
END as status
FROM daily_stats d
JOIN stats s ON d.recipient_name = s.recipient_name
WHERE date >= current_date() - INTERVAL 7 DAYS
ORDER BY d.date DESC, d.daily_requests DESC
""")
Pattern 4: Automated Share Management
CI/CD for Share Configuration:
"""
Automated share management from configuration.
"""
import yaml
from typing import Dict, List, Any
class ShareConfigManager:
"""Manage shares from YAML configuration."""
def __init__(self, workspace_client: WorkspaceClient):
self.client = workspace_client
def load_config(self, config_path: str) -> Dict[str, Any]:
"""Load share configuration from YAML."""
with open(config_path, 'r') as f:
return yaml.safe_load(f)
def apply_config(self, config: Dict[str, Any]):
"""Apply share configuration."""
for share_config in config.get('shares', []):
self._create_or_update_share(share_config)
for recipient_config in config.get('recipients', []):
self._create_or_update_recipient(recipient_config)
for grant_config in config.get('grants', []):
self._apply_grants(grant_config)
def _create_or_update_share(self, config: Dict[str, Any]):
"""Create or update a share."""
try:
existing = self.client.shares.get(name=config['name'])
print(f"Share {config['name']} already exists")
except:
self.client.shares.create(
name=config['name'],
comment=config.get('comment', '')
)
print(f"Created share: {config['name']}")
# Add tables
for table in config.get('tables', []):
self.client.shares.update(
name=config['name'],
updates=[{
"action": "ADD",
"data_object": {
"name": table,
"data_object_type": "TABLE"
}
}]
)
Example Configuration (shares.yaml):
shares:
- name: partner_analytics_share
comment: Analytics data for partners
tables:
- catalog.analytics.customer_metrics
- catalog.analytics.product_performance
- catalog.analytics.sales_summary
recipients:
- name: acme_corp
comment: ACME Corporation
authentication_type: TOKEN
email: data-team@acme.com
- name: globex_inc
comment: Globex Inc
authentication_type: TOKEN
email: analytics@globex.com
grants:
- share: partner_analytics_share
recipient: acme_corp
permissions: [SELECT]
- share: partner_analytics_share
recipient: globex_inc
permissions: [SELECT]
Best Practices
1. Security
- Use token-based authentication
- Implement row-level security when needed
- Regular audit of access permissions
- Monitor for unusual access patterns
- Rotate recipient tokens periodically
2. Performance
- Share aggregated data when possible
- Use partition pruning for large tables
- Monitor query performance
- Implement caching strategies
- Limit result set sizes
3. Governance
- Document all shares and recipients
- Maintain share configuration in version control
- Regular access reviews
- Clear data ownership
- Defined SLAs for shared data
4. Monitoring
# Set up alerts for anomalous usage
def check_usage_threshold(spark, share_name: str, threshold_gb: float = 100):
"""Alert if daily data transfer exceeds threshold."""
query = f"""
SELECT
SUM(bytes_transferred) / 1024 / 1024 / 1024 as gb_transferred
FROM system.access.audit
WHERE share_name = '{share_name}'
AND date_trunc('day', request_time) = current_date()
"""
result = spark.sql(query).first()
gb_transferred = result['gb_transferred'] or 0
if gb_transferred > threshold_gb:
send_alert(
f"Share {share_name} transferred {gb_transferred:.2f}GB today, "
f"exceeding threshold of {threshold_gb}GB"
)
Common Pitfalls to Avoid
Don't:
- Share raw PII without review
- Neglect access auditing
- Skip documentation
- Ignore usage monitoring
- Hard-code credentials
Do:
- Implement data masking for sensitive fields
- Regular access audits
- Document all shares
- Monitor usage patterns
- Use secure credential management
Complete Examples
See /examples/ directory for:
external_data_sharing.py: Complete external sharing setupmulti_tenant_sharing.py: Multi-tenant implementation
Related Skills
data-products: Share data productsdata-quality: Ensure shared data qualitymedallion-architecture: Share gold layer tablescicd-workflows: Automate share management
References
版本历史
-
skills-20261103210927-6c1b454
GitHub ↗
原版更新说明
Automated skills release from commit 6c1b4543cac1d45a80bf5904e4b69ac315117323
-
skills-20260928190452-ff51758
GitHub ↗
原版更新说明
Automated skills release from commit ff51758b06b8249007116184096765d47bdb7505
-
skills-20260924105536-d31110d
GitHub ↗
原版更新说明
Automated skills release from commit d31110d62dc0bd00c22f1d6f6a630d1e702a0049
-
skills-20260923085113-cea285e
GitHub ↗
原版更新说明
Automated skills release from commit cea285ef0e4d6ec47cd2fd9fdbca03813a3363c7
-
skills-20260922193956-97d7333
GitHub ↗
原版更新说明
Automated skills release from commit 97d7333d8200e5ac556c659c8669f3a83ba10866
此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Delta Sharing 配置、监控和接收方管理的完整解决方案
- 解决跨组织数据共享的实际业务痛点,具有高实用价值
- 涵盖多租户、行级安全、使用分析等高级场景
亮点
- description 明确描述功能范围和适用场景
- 触发词精准完整,边界清晰,无歧义
亮点
- 文档结构完整,包含从概述到最佳实践的全方位内容
- 提供多个端到端实现模式和完整代码示例
- frontmatter 完整,文档长度适中
亮点
- 使用 Databricks 官方 SDK,工具来源明确
- 代码示例参数正确,覆盖主要异常处理场景
- 不可逆操作有合理的业务逻辑控制和安全措施
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
读取本地文件
限定到你选择的文件或项目目录;避免读取无关的个人资料、密钥和配置文件。
主文档提及 · 第 412 行 -
保存或修改文件
先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。
主文档提及 · 第 93, 231 行 -
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 540, 547 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- docs.databricks.com
- github.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。