Python SDK for SED (Semantic Entities Designs) - Full TypeScript CLI Integration
Project description
SEDQL Python SDK
Python SDK for SED (Semantic Entities Designs) - Full TypeScript CLI Integration
SED automatically converts your raw database into an AI-ready semantic layer with intelligent business rules.
🚀 Quick Start
Installation
# Install the Python package
pip install sedql
# Install the SED CLI (required)
npm install -g sed-cli
Basic Usage
from sedql import SEDClient
# Initialize enhanced client (no database URL needed)
sed = SEDClient()
# Initialize SED with database connection
sed.init()
# Build semantic layer
sed.build()
# Query with natural language
result = sed.query("Show me customers with high revenue")
print(result)
# Query with AI integration and full SED features
ai_result = sed.query_with_ai({
"natural_language": "Forecast revenue for Q3 2024",
"ai_model": "gpt-4",
"business_context": "Revenue forecasting for Q3 planning"
})
# Access rich response with all features
print(f"Data: {ai_result['query_result']}")
print(f"Insights: {ai_result['insights']}")
print(f"Risk Level: {ai_result['risk_assessment']['risk_level']}")
print(f"Business Context: {ai_result['business_context']}")
✨ What You Get
Full TypeScript CLI Integration
- ✅ Business Rules Engine - Query validation & governance
- ✅ Schema Change Detection - Automatic change monitoring
- ✅ Security Validation - Business rule enforcement
- ✅ Audit Trail - Rule evaluation tracking
- ✅ Performance Optimization - Query analysis
- ✅ Business Context - Semantic layer with domain knowledge
- ✅ AI Integration Framework - Hooks for your AI providers
Rich Response Structure
response = {
'query_result': {...}, # Query execution results
'ai_enhancement': {...}, # AI processing results
'business_context': {...}, # Business domain knowledge
'insights': {...}, # Data insights and analysis
'risk_assessment': {...}, # Security risk analysis
'metadata': {...} # Query metadata
}
📋 Requirements
- Python: 3.8+
- SED CLI:
npm install -g sed-cli(provides all the advanced features) - Database: PostgreSQL, MySQL, SQLite (handled by CLI config)
🔧 Installation
1. Install SED CLI (Required)
npm install -g sed-cli
2. Install Python Package
pip install sedql
📖 API Reference
SEDClient
Main client class that provides full access to SED CLI capabilities.
Core Methods
init(force=False)- Initialize SED with database connectionbuild(output_file=None)- Build or rebuild semantic layerquery(natural_language_query, verbose=False)- Query database using natural languagequery_with_ai(query_params)- Query with AI integration and full SED features
Advanced Features
detect_changes(format="json")- Detect schema changes with analysisget_status()- Get current SED status with business rulesexport_config(format="json", output_file=None)- Export configurationvalidate()- Validate semantic layer and business rulesget_semantic_mapping()- Get business entities and relationships
🎯 Use Cases
- Data Engineering: Programmatically build semantic layers
- Data Science: Query databases using natural language with AI
- Application Integration: Embed SED functionality in Python apps
- Automation: Script database discovery and mapping
- AI Development: Provide semantic context to LLMs
- Data Governance: Automatic PII protection and compliance
🔍 Examples
Enhanced Query with AI
from sedql import SEDClient
# Create enhanced client
sed = SEDClient()
# Execute AI-enhanced query with full SED features
response = sed.query_with_ai({
"natural_language": "Show me customer retention trends",
"ai_model": "gpt-4",
"business_context": "Customer analytics and retention analysis"
})
# Access all the rich features
print("🎯 Query Results:")
print(f" Data: {response['query_result']}")
print("🔒 Security & Compliance:")
print(f" Risk Level: {response['risk_assessment']['risk_level']}")
print(f" Validation: {response['validation']}")
print("💼 Business Intelligence:")
print(f" Context: {response['business_context']}")
print(f" Insights: {response['insights']}")
Business Rules and Validation
# Get current status with business rules
status = sed.get_status()
print(f"Business Rules: {status.get('rules', {})}")
# Validate semantic layer
validation = sed.validate()
print(f"Validation Status: {validation.get('summary', {}).get('status')}")
# Detect schema changes
changes = sed.detect_changes(format="json")
print(f"Total Changes: {changes.get('analysis', {}).get('total_changes', 0)}")
🌟 Why SEDQL Python SDK?
Full CLI Power in Python
- Access to all
sed-clifeatures from Python - Business rules engine and validation
- Schema change detection and analysis
- Rich response processing and insights
Enterprise Ready
- Local-first architecture (no data leaves your machine)
- Automatic PII protection and compliance
- Business rule generation and enforcement
- Professional-grade security and audit trails
AI Integration Ready
- Semantic layer for LLM context
- Business terminology mapping
- Risk assessment and validation
- Custom AI client integration
🔗 Related Projects
- sed-cli - Core TypeScript CLI (npm package)
- GitHub Repository - Source code and documentation
📄 License
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Built with ❤️ by the SED Team
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sedql-1.0.7.tar.gz.
File metadata
- Download URL: sedql-1.0.7.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59744df1e10a5bd3ee75717bc172a1696e9cc5e1502db955618a063eb93cb90c
|
|
| MD5 |
59ffb35833db7f9b52dbb987b2dc92d0
|
|
| BLAKE2b-256 |
0bdc50543d7dbe9da768e0b23d6875a13c45478c8504e77df20bbaceab8c519d
|
File details
Details for the file sedql-1.0.7-py3-none-any.whl.
File metadata
- Download URL: sedql-1.0.7-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a63cf3dbf57af3a70cfc241b086d146356761800c2cf1227d42123f1fca5a8e
|
|
| MD5 |
933cf6dc1e8ab80f12e9d57f28be9b6e
|
|
| BLAKE2b-256 |
a420c8b70b9d44171a7f39cb3bd1b8d296952295b874fdb881360b894c95c834
|