Skip to content

v5.0.0 - #43

Draft
ddc wants to merge 3 commits into
mainfrom
v4.0.2
Draft

v5.0.0#43
ddc wants to merge 3 commits into
mainfrom
v4.0.2

Conversation

@ddc

@ddc ddc commented Apr 3, 2026

Copy link
Copy Markdown
Owner

Summary

fetchvalue now returns raw value instead of string.

[v5.0.0] Breaking Changes

  • DBUtils.fetchvalue() and DBUtilsAsync.fetchvalue() now return the value with its
    native type.
    They previously coerced every result with str().

    # 4.x
    db.fetchvalue(select(func.count()).select_from(Model))   # "42"   (str)
    db.fetchvalue(select(Model.created_at))                  # "2026-08-12 15:04:05+00:00"
    
    # 5.0.0
    db.fetchvalue(select(func.count()).select_from(Model))   # 42     (int)
    db.fetchvalue(select(Model.created_at))                  # datetime(2026, 8, 12, ...)

    This is silent at import time: code that treated the result as a string (.startswith(),
    == "1", datetime.fromisoformat(...), string concatenation) will now fail at runtime or
    behave differently.

    Migration. Where a string is genuinely wanted, coerce at the call site — and note that
    a bare str() turns None into the string "None":

    value = db.fetchvalue(stmt)
    value = str(value) if value is not None else None

    Code that parsed the result back into a real type can now drop the parsing:

    # 4.x
    dt = datetime.fromisoformat(db.fetchvalue(select(Model.created_at)))
    # 5.0.0
    dt = db.fetchvalue(select(Model.created_at))

    fetchall() was already returning native types and is unaffected.

Type of Change

  • Bug fix
  • New feature
  • Breaking change (existing functionality affected)
  • Refactoring (no functional changes)
  • Documentation
  • CI/CD or build configuration
  • Dependencies update
  • Other

Testing

  • Manual testing performed

Reviewer

  • I understand that by approving this PR, I share responsibility for these changes

@ddc ddc self-assigned this Apr 3, 2026
@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
ddcdatabases/core/configs.py 93.24% <100.00%> (ø)
ddcdatabases/core/constants.py 100.00% <100.00%> (ø)

@ddc ddc changed the title v4.0.2 v5.0.0 Aug 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant