| 12345678910111213141516171819202122 |
- from databases import CRUD, SqlQuery, PhotoRecord
- from datetime import datetime
- session = SqlQuery()
- crud = CRUD(PhotoRecord)
- res = crud.read(session,conditions={"image_path":None})
- if res:
- time_str = "2025-03-26 19:29:39.954187"
- time_str_without_ms = time_str.split(".")[0]
- update = {
- "image_path": "sadasda",
- "image_index": 0,
- "photo_create_time": datetime.strptime(
- time_str_without_ms, "%Y-%m-%d %H:%M"
- ),
- }
- res.__dict__
- crud.update(
- session,
- res.id,
- **update,
- )
|