반응형
[Python & SQLAlchemy] orm에서 order_by를 사용하여 최근날짜 순으로 정렬하는 방법 !!
sqlalchemy orm에서 order_by를 사용하여 최근날짜 순으로 정렬하는 예시 코드입니다.
예시에 나와 있는 created_at은 datetime 형식입니다 :)
예제코드
UserDBs = db.query(UserAccessLogDB).order_by(UserAccessLogDB.created_at.desc()).all()
728x90
반응형
'Coding > Python' 카테고리의 다른 글
[Python] PIL 라이브러리를 사용하여 사진 사이즈 변경하는 방법 !! (크기 줄이기) (0) | 2024.05.14 |
---|---|
[Python & PyAutoGUI] pyautogui.FailSafeException: 에러 해결 방법 (0) | 2024.05.11 |
[Python & SQLAlchemy] orm으로 update문 사용하는 방법 !! (0) | 2024.05.07 |
[Python & Matplotlib] 학생들 성적 시각화 예시 (0) | 2024.05.04 |
[Python & Django] No module named 'mathfilters' when adding to INSTALLED_APPS 에러 해결 방법 !! (0) | 2024.04.17 |
댓글