https://github.com/agentops-ai/clickorm
https://github.com/agentops-ai/clickorm
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/agentops-ai/clickorm
- Owner: AgentOps-AI
- Created: 2025-03-12T23:40:23.000Z (about 1 year ago)
- Default Branch: devin/1741822960-python-orm-framework
- Last Pushed: 2025-03-13T00:11:49.000Z (about 1 year ago)
- Last Synced: 2025-06-01T22:43:16.575Z (10 months ago)
- Language: Python
- Size: 67.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ClickORM
A Python ORM framework for ClickHouse with Pydantic integration.
## Features
- Seamless integration with Pydantic for data validation and serialization
- Type-safe query building
- Automatic schema generation and migration
- Support for all ClickHouse data types
- Efficient connection management
- Comprehensive error handling
## Installation
```bash
pip install clickorm
```
## Quick Start
```python
from datetime import datetime
from typing import List, Optional
from clickorm import Model, Column, ConnectionManager, types
# Define your model
class User(Model):
id: int = Column(primary_key=True)
name: str = Column()
email: str = Column(index=True)
created_at: datetime = Column(default=datetime.utcnow)
class Meta:
table_name = "users"
engine = "MergeTree()"
order_by = "id"
# Connect to ClickHouse
conn = ConnectionManager(host="localhost", port=9000, database="default")
conn.set_as_default()
# Create the table
User.create_table()
# Insert a user
user = User(name="John Doe", email="john@example.com")
user.save()
# Query users
users = User.query.filter(User.name.like("John%")).all()
for user in users:
print(f"User: {user.name}, Email: {user.email}")
# Update a user
user.name = "Jane Doe"
user.save()
# Delete a user
user.delete()
```
## Documentation
For more detailed documentation, see [the full documentation](https://github.com/AgentOps-AI/clickorm).
## License
MIT