← Back to Pull requests

feat!: allow override of `registry` for declarative bases #307

Closed
unknown closed this pull request without merging on Dec 05, 2024 18:21 UTC
View on GitHub
unknown unknown commented on Dec 04, 2024 17:14 UTC
Author

<!--
By submitting this pull request, you agree to:

  • follow Litestar's Code of Conduct

  • follow Litestar's contribution guidelines

  • follow the PSFs's Code of Conduct

  • -->

    Description

    This PR allows you to resuse the existing DeclarativeBase subclasses with different metadata objects.

    This enables better support for multi-database configurations with models targets for each specific database.

    It:

  • Creates a singleton registry object that tracks Metadata's for models

  • uses the __bind_key__ syntax commonly found in flask-slqlalchemy and other SQLAlchemy libraries
  • As part of this, there are a few (minor) breaking changes:

  • The custom subclass for AlembicCommands has been removed. It is no longer required and will make things easier for fastapi integration

  • The Alembic configuration now longer has a template_metadata key
  • <!--
    Please add in issue numbers this pull request will close, if applicable
    Examples: Fixes #4321 or Closes #1234

    Ensure you are using a supported keyword to properly link an issue:
    https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
    -->

    Closes

    Diff: 175 lines (+131 / -44) across 2 files Reviewer: Alc-Alc Review duration: 1507m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 175 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.309
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #307"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.4% (MEDIUM) · Higher = larger blast radius
    35.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.0% · Safe to merge
    14.0%