Skip to content

chore: replace deprecated datetime.utcnow Column defaults with datetime.now(timezone.utc) in database/models.py#15

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1772849871-replace-deprecated-utcnow
Open

chore: replace deprecated datetime.utcnow Column defaults with datetime.now(timezone.utc) in database/models.py#15
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1772849871-replace-deprecated-utcnow

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

chore: replace deprecated datetime.utcnow Column defaults with datetime.now(timezone.utc)

Summary

Replaces the deprecated default=datetime.utcnow callable in FXRate.scraped_at and MidMarketRate.scraped_at Column definitions with default=lambda: datetime.now(timezone.utc).replace(tzinfo=None).

datetime.utcnow was deprecated in Python 3.12 (this repo runs on 3.12.8) and emits DeprecationWarning on every row INSERT since SQLAlchemy invokes the default callable each time. The replacement uses .replace(tzinfo=None) to continue producing naive UTC datetimes, maintaining compatibility with the existing SQLite schema and any code that reads these columns.

Review & Testing Checklist for Human

  • Verify that .replace(tzinfo=None) is the right approach for this codebase — if other parts of the app expect timezone-aware datetimes, this would need to change
  • Note that other datetime.utcnow() call sites exist in main.py and scrapers/base.py and are not addressed here — confirm this scoping is intentional
  • Recommended test: run python main.py --demo and inspect the scraped_at values in fx_fees.db to confirm they are still naive UTC datetimes

Notes

…me.now(timezone.utc)

Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants