Skip to content

Release v0.2.2

Choose a tag to compare

@oranheim oranheim released this 05 Aug 17:16
· 28 commits to master since this release

Release Notes - v0.2.2

πŸ•’ Enhanced Date and Timestamp Support

This release significantly improves how psycopg-toolkit handles PostgreSQL date and timestamp fields, making it easier to work with temporal data across your applications.

✨ New Features

  • Full TIMESTAMP Support: The date_fields parameter now properly handles PostgreSQL TIMESTAMP and TIMESTAMPTZ columns in addition to DATE columns
  • Unified Date/DateTime Conversion: Both datetime.date and datetime.datetime objects are now seamlessly converted to ISO format strings for Pydantic models
  • Comprehensive Field Coverage: You can now include all temporal fields (DATE, TIMESTAMP, TIMESTAMPTZ) in the date_fields parameter for consistent handling

πŸ› Bug Fixes

  • Fixed Duplicate Processing: Removed duplicate date field processing logic in _postprocess_data method that could cause performance issues
  • Improved Type Handling: Better detection and conversion of both date and datetime objects from PostgreSQL

πŸ“š Documentation Improvements

  • Enhanced Examples: Updated array_and_date_fields.py example to demonstrate proper TIMESTAMP usage
  • Clearer Guidelines: Added comprehensive documentation explaining when and how to use date_fields for all temporal column types
  • Common Pitfalls Section: New documentation section highlighting typical mistakes and their solutions
  • Expected Warnings Note: Added clarification about expected "Failed to deserialize JSON field" warnings when using auto_detect_json=True

πŸ§ͺ Testing

  • New Test Coverage: Added specific tests for datetime field conversion to ensure reliability
  • Expanded Test Suite: Enhanced existing date field tests to cover more edge cases

πŸ’‘ Usage Updates

Before v0.2.2:

date_fields={"birthdate"}  # Only DATE columns

After v0.2.2:

date_fields={"birthdate", "created_at", "updated_at", "last_login"}  # ALL temporal fields

⚠️ Important Notes

  • Migration Recommended: If you're using timestamp fields, update your date_fields configuration to include all temporal columns for consistent behavior
  • No Breaking Changes: Existing code will continue to work, but you may want to expand your date_fields configuration to take advantage of the improved timestamp support

πŸ”§ Technical Details

  • Enhanced _preprocess_data and _postprocess_data methods for better temporal field handling
  • Improved logging to distinguish between date and datetime conversions
  • Better error handling for edge cases in temporal data processing