Skip to content

[BUG]: echo=True hardcoded in database.py — all SQL queries printed to stdout #372

@abhishek-8081

Description

@abhishek-8081

⚡️ Describe the Bug

In api/db/database.py, the SQLAlchemy engine is created with echo=True hardcoded on line 7. This causes every SQL query to be printed to stdout on every API request, making terminal output really noisy and hard to read when trying to debug other things.

👣 Steps to Reproduce

  1. Initialize the database with python -m api.db.init_db
  2. Start the API with uvicorn api.main:app --reload
  3. Hit any endpoint, e.g. POST /templates/create
  4. Check terminal — raw SQL statements like BEGIN, INSERT INTO template ..., COMMIT flood the output

📉 Expected Behavior

SQL echo should be off by default. Developers should be able to toggle it on when needed for debugging, not have it always dumping queries to stdout.

🖥️ Environment Information

  • OS: macOS
  • Docker/Compose Version: Docker 27.x / Compose v2
  • Ollama Model used: mistral

📸 Screenshots/Logs

Image
engine = create_engine(
    DATABASE_URL,
    echo=True,  # hardcoded, no way to toggle off
    connect_args={"check_same_thread": False},
)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions