{"id":22743024,"url":"https://github.com/yashkumarverma/celery-sqlcommenter","last_synced_at":"2026-05-03T04:34:58.315Z","repository":{"id":266950373,"uuid":"898469155","full_name":"YashKumarVerma/celery-sqlcommenter","owner":"YashKumarVerma","description":"Attach SQL comments to correlate celery tasks with SQL statements.","archived":false,"fork":false,"pushed_at":"2024-12-25T06:17:34.000Z","size":72,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T06:44:58.059Z","etag":null,"topics":["async","celery","database-queries","django","instrumentation"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/celery-sqlcommenter/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YashKumarVerma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-04T13:00:48.000Z","updated_at":"2024-12-25T06:17:37.000Z","dependencies_parsed_at":"2024-12-07T08:19:10.894Z","dependency_job_id":"ac177662-cd73-406d-a772-8c373e999a3b","html_url":"https://github.com/YashKumarVerma/celery-sqlcommenter","commit_stats":null,"previous_names":["yashkumarverma/celery-sqlcommenter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YashKumarVerma%2Fcelery-sqlcommenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YashKumarVerma%2Fcelery-sqlcommenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YashKumarVerma%2Fcelery-sqlcommenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YashKumarVerma%2Fcelery-sqlcommenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YashKumarVerma","download_url":"https://codeload.github.com/YashKumarVerma/celery-sqlcommenter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246277347,"owners_count":20751548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","celery","database-queries","django","instrumentation"],"created_at":"2024-12-11T01:15:40.690Z","updated_at":"2026-05-03T04:34:58.310Z","avatar_url":"https://github.com/YashKumarVerma.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# celery-sqlcommenter\nAttach SQL comments to correlate celery tasks with SQL statements.\n\n\nThis 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.\n\n## When to use?\nYou're using [celery](https://docs.celeryq.dev/en/stable/) with django, and want to trace the origin of database queries.\n\n\n## Does it replace / overlap [sqlcommenter](https://google.github.io/sqlcommenter/#frameworks)\nNo. 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. \n\nThis package fills that gap.\n\n## How to use\n\nIn a simple celery setup, just passing the `BaseTask` when declaring a celery object will do the job.\n```py\n# if not using a base class, pass directly where you declare celery config\nfrom celery_sqlcommenter import BaseTask\napp = Celery(\"my-awsome-application\", task_cls=BaseTask)\n\n```\n\n\nIf you already have a custom `BaseTask` with specific functionality, replace the original `celery.Task` with `celery_sqlcommenter.BaseTask`\n```py\n# old configuration\nfrom celery import Task\nclass MyBaseTask(Task):\n\n    # custom methods you've implemented\n    def on_failure(self, exc, task_id, args, kwargs):\n        pass\n\n\n# simply replace Task with BaseTask provided by the package\nfrom celery_sqlcommenter import BaseTask\n\n\n# notice Task changed to BaseTask\nclass MyBaseTask(BaseTask):\n\n    # custom methods you've implemented\n    def on_failure(self, exc, task_id, args, kwargs):\n        pass\n\n```\n_Internally BaseTask inherits `celery.Task` so all functionality stays intact_\n\n\n## How to install\nInstall the package from pypi\n```\n# vanilla\npip install celery-sqlcommenter\n\n# poetry \npoetry add celery-sqlcommenter\n```\n\n## How does it look live?\n![a simple celery task that takes a while](./docs/images/aws-rds-session-query.png)\n\n## More Questions?\nPlease open an issue or drop a message on my socials, will be happy to help.\n\n[![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/yash-kumar-verma/)\n[![X](https://img.shields.io/badge/X-%23000000.svg?style=for-the-badge\u0026logo=X\u0026logoColor=white)](https://x.com/yash_kr_verma)\n\n\n## How to publish \n- poetry build\n- poetry config pypi-token.pypi \u003cyour-pypi-token\u003e\n- poetry publish","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyashkumarverma%2Fcelery-sqlcommenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyashkumarverma%2Fcelery-sqlcommenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyashkumarverma%2Fcelery-sqlcommenter/lists"}