Skip to content

refactor: skip real DB connections entirely in REPLAY mode#59

Closed
jy-tan wants to merge 2 commits intomainfrom
fix-db-connect
Closed

refactor: skip real DB connections entirely in REPLAY mode#59
jy-tan wants to merge 2 commits intomainfrom
fix-db-connect

Conversation

@jy-tan
Copy link
Copy Markdown
Contributor

@jy-tan jy-tan commented Feb 2, 2026

Summary

Changes REPLAY mode behavior to use MockConnection directly without attempting real database connections. This enables true dependency-free replay where no database server is required at all.

Changes

  • psycopg & psycopg2: In REPLAY mode, skip real DB connection attempts entirely and use MockConnection directly
    • Previously: Tried to connect to real DB, fell back to mock on failure
    • Now: Uses mock immediately without any connection attempt
    • Benefit: Faster startup, no DB server required, truly dependency-free replay
  • psycopg2: Fix django_prometheus compatibility by setting a default cursor_factory when None is provided
    • django_prometheus does conn.cursor_factory or Cursor() which fails if cursor_factory is None

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@jy-tan jy-tan closed this Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants