Skip to content

refactor: decompose base.py (1,315 lines) into compiler/dialect/database modules #50

Description

@dtsong

Problem

data_diff/databases/base.py (1,315 lines) bundles four distinct responsibilities:

  1. Compiler — SQL AST compilation
  2. BaseDialect — SQL dialect abstraction
  3. Database — Connection management (cloud/async)
  4. ThreadedDatabase — Connection pooling (cursor-based)

Every driver author must understand the entire file. This is a barrier to contribution.

Proposed Decomposition

data_diff/databases/
  compiler.py       # Compiler class
  dialect.py        # BaseDialect ABC
  database.py       # Database + ThreadedDatabase ABCs
  base.py           # Re-exports for backward compatibility (temporary)

Constraints

  • All existing imports must continue working
  • No behavioral changes
  • Driver files should not need modification

Acceptance Criteria

  • base.py split into 3-4 focused modules
  • All existing tests pass without modification
  • Backward-compatible re-exports in base.py

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions