Skip to content

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

@dtsong

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions