semvec/pypi-packages huggingface dataset:
celery-sqlcommenter 0.2
instrument sql queries running on celery
License: MIT
Requires Python: <=3.14,>=3.8

# celery-sqlcommenter
Attach SQL comments to correlate celery tasks with SQL statements.


This helps in easily correlating slow performance with async tasks and giving insights into backend database performance. In short it provides some observability into the state of your client-side applications and their impact on the database’s server-side.

## When to use?
You're using [celery](https://docs.celeryq.dev/en/stable/) with django, and want to trace the origin of database queries.


## Does it replace / overlap [sqlcommenter](https://google.github.io/sqlcommenter/#frameworks)
No. I've been using sqlcommenter in production and it lacked the ability to annotate queries that were run in non-http context. Meaning all queries that originated from async flows were untagged. 

This package fills that gap.

## How to use

In a simple celery setup, just passing the `BaseTask` when declaring a celery object will do the job.
```py
# if not using a base class, pass directly where you declare celery config
from celery_sqlcommenter import BaseTask
app = Celery("my-awsome-application", task_cls=BaseTask)

```


If you already have a custom `BaseTask` with specific functionality, replace the original `celery.Task` with `celery_sqlcommenter.BaseTask`
```py
# old configuration
from celery import Task
class MyBaseTask(Task):

    # custom methods you've implemented
    def on_failure(self, exc, task_id, args, kwargs):
        pass


# simply replace Task with BaseTask provided by the package
from celery_sqlcommenter import BaseTask


# notice Task changed to BaseTask
class MyBaseTask(BaseTask):

    # custom methods you've implemented
    def on_failure(self, exc, task_id, args, kwargs):
        pass

```
_Internally BaseTask inherits `celery.Task` so all functionality stays intact_


## How to install
Install the package from pypi
```
# vanilla
pip install celery-sqlcommenter

# poetry 
poetry add celery-sqlcommenter
```

## How does it look live?
![a simple celery task that takes a while](./docs/images/aws-rds-session-query.png)

## More Questions?
Please open an issue or drop a message on my socials, will be happy to help.

[![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/yash-kumar-verma/)
[![X](https://img.shields.io/badge/X-%23000000.svg?style=for-the-badge&logo=X&logoColor=white)](https://x.com/yash_kr_verma)


## How to publish 
- poetry build
- poetry config pypi-token.pypi <your-pypi-token>
- poetry publish
json2orm 0.1.0
A simple JSON-based ORM for Python
License: MIT
Requires Python: >=3.7

# JSON2ORM

A lightweight **JSON-based ORM** for Python 🚀  
No SQL, no external DB engine — just plain JSON files acting like a database.

Perfect for **small projects, testing, prototyping** or educational purposes.

---

## ✨ Features
- Define models like in Django ORM or Prisma
- Auto-increment IDs for each model
- Basic CRUD support (`create`, `all`, `get`, `save`, `delete`)
- Simple JSON file storage, no setup required
- Human-readable database (`.json` file)

---

## 📦 Installation
```bash
pip install json2orm
```

---

## ⚡ Quick Start Example

```python
from json2orm import Database, Model

# Setup database (JSON file)
db = Database("mydb.json")

# Define models
class User(Model):
    table_name = "users"

class Post(Model):
    table_name = "posts"


# Create users
u1 = User.create(name="Ali", email="ali@test.com")
u2 = User.create(name="Sara", email="sara@test.com")
print([u.name for u in User.all()])  # ➝ ['Ali', 'Sara']

# Get user
ali = User.get(name="Ali")
print(ali.email)  # ➝ ali@test.com

# Update user
ali.email = "ali_updated@test.com"
ali.save()
print(User.get(id=1).email)  # ➝ ali_updated@test.com

# Delete user
u2.delete()
print([u.name for u in User.all()])  # ➝ ['Ali']

# Create posts
p1 = Post.create(title="First Post", content="Hello World", user_id=ali.id)
p2 = Post.create(title="Second Post", content="Next Post", user_id=ali.id)

print([p.title for p in Post.all()])  # ➝ ['First Post', 'Second Post']
```

---

## 🔮 Roadmap / Future Features
JSONORM is in its early stages. Planned features include:

- [ ] **Field definitions in models** (like Django `models.CharField`, `IntegerField`, etc.)
- [ ] **Schema validation** (prevent invalid fields)
- [ ] **Query filters** (e.g., `User.filter(age__gt=18)`)
- [ ] **Export database** (to CSV, SQLite, MongoDB, etc.)
- [ ] **Simple GUI** for browsing and editing JSON-based data
- [ ] **CLI tool** to manage database & migrations
- [ ] **Relationships** (OneToMany / ManyToMany)

---

## 🧪 Running Tests
You can run the provided example tests:

```bash
python examples/test_example.py
```

Expected output is included as comments in the file.

---

## 📜 License
This project is licensed under the **MIT License**.  
Feel free to use, modify and distribute.

---

## ❤️ Contributing
PRs are welcome! Ideas, bug reports, and feature requests are highly appreciated.