Skip to content

v5.0.0 - #43

Merged
ddc merged 6 commits into
mainfrom
v4.0.2
Aug 17, 2026
Merged

v5.0.0#43
ddc merged 6 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

@ddc
ddc marked this pull request as ready for review August 17, 2026 19:28
@sonarqubecloud

Copy link
Copy Markdown

@ddc
ddc merged commit a202e09 into main Aug 17, 2026
13 checks passed
@ddc
ddc deleted the v4.0.2 branch August 17, 2026 19:33
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