--- id: google-cloud-sqlcommenter version: "2.0.0" license: BSD license_treatment: permissive maintenance: abandoned --- # google-cloud-sqlcommenter — Augment SQL statements with meta information about frameworks and the running environment. License: permissive · Maintenance: abandoned · Downloads: 534.3K/mo ## What it is and what it does sqlcommenter is a set of middleware and cursor factories that automatically append SQL comments containing metadata to database queries. It works by intercepting queries at the ORM or driver level—Django middleware, SQLAlchemy event listeners, or Psycopg2 cursor factories—and injecting structured comments that capture framework version, HTTP route, controller/endpoint name, and optionally distributed trace context via OpenCensus or OpenTelemetry. The comments appear in database logs, making it easier to correlate slow queries or errors back to the application code that triggered them. The package supports Django, SQLAlchemy, and Psycopg2 with configurable options for which metadata to include. It has no runtime dependencies for basic use, though OpenCensus and OpenTelemetry can be installed as optional extras. However, the project is abandoned—the last release was 2021-08-18—so it will not receive updates for compatibility with newer framework versions or security fixes. Use it for: - Add framework and route metadata to SQL logs in Django applications to correlate slow queries with specific views - Inject trace IDs into SQLAlchemy queries for distributed tracing across microservices - Embed driver and connection pool info in Psycopg2 logs to debug database connection issues - Capture OpenTelemetry trace context in SQL comments for end-to-end request tracing - Augment database audit logs with application context without modifying query code ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automatically injects metadata comments into SQL queries executed through Django, SQLAlchemy, or Psycopg2, capturing framework version, route, controller, and optionally trace context. No. The package is abandoned (last release 2021-08-18) and will not receive updates for compatibility with modern framework versions or security issues. While the core concept is sound and the BSD license is permissive, the lack of maintenance makes it a liability for new projects. Consider alternatives that are actively maintained. ## Install pip install google-cloud-sqlcommenter uv add google-cloud-sqlcommenter poetry add google-cloud-sqlcommenter ## Installing google-cloud-sqlcommenter Before you install: Installation is straightforward with no runtime dependencies for the base package. However, the project is abandoned—last release was 2021-08-18, over 1822 days ago—so no maintenance or security updates are expected. License in practice: BSD license is permissive, allowing commercial use, modification, and distribution with minimal restrictions. No licensing barrier to adoption. Quickstart: # Django pip install google-cloud-sqlcommenter # Add to settings.py MIDDLEWARE: MIDDLEWARE = [ 'google.cloud.sqlcommenter.django.middleware.SqlCommenter', ] # SQLAlchemy from google.cloud.sqlcommenter.sqlalchemy.executor import BeforeExecuteFactory listener = BeforeExecuteFactory(with_db_driver=True) sqlalchemy.event.listen(engine, 'before_cursor_execute', listener, retval=True) # Psycopg2 from google.cloud.sqlcommenter.psycopg2.extension import CommenterCursorFactory cursor_factory = CommenterCursorFactory(with_db_driver=True) conn = psycopg2.connect(..., cursor_factory=cursor_factory) Verify before relying: - Whether the package works correctly with modern versions of Django, SQLAlchemy, or Psycopg2 released after 2021-08-18 - Whether OpenCensus and OpenTelemetry optional dependencies are still compatible with current versions - Whether the package is maintained under a different repository or organization ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 534.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sql query annotation, django sqlalchemy psycopg2 middleware, sql comment injection, database query metadata, trace context sql logging, framework-aware sql comments, query instrumentation, sql-instrumentation, observability, abandoned [View on SkillFed](https://skillfed.io/packages/google-cloud-sqlcommenter) · [View on PyPI](https://pypi.org/project/google-cloud-sqlcommenter/)