fix: fetch db sqlite dengan aturan sort desc
This commit is contained in:
parent
a3837e9b1a
commit
fc04f6d220
2 changed files with 6 additions and 5 deletions
3
main.py
3
main.py
|
@ -9,7 +9,7 @@ from datetime import datetime
|
||||||
import requests
|
import requests
|
||||||
import telegram
|
import telegram
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from sqlalchemy import update
|
from sqlalchemy import desc, update
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
|
||||||
from models import Notifikasi, Session
|
from models import Notifikasi, Session
|
||||||
|
@ -91,6 +91,7 @@ async def kirim_ke_tele():
|
||||||
cek_data = (
|
cek_data = (
|
||||||
session.query(Notifikasi)
|
session.query(Notifikasi)
|
||||||
.filter(Notifikasi.remark.like("%elu%"))
|
.filter(Notifikasi.remark.like("%elu%"))
|
||||||
|
.order_by(desc(Notifikasi.id))
|
||||||
.limit(10)
|
.limit(10)
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
requests=2.32.3
|
requests==2.32.3
|
||||||
sqlalchemy=2.0.35
|
sqlalchemy==2.0.35
|
||||||
python-telegram-bot=21.6
|
python-telegram-bot==21.6
|
||||||
python-dotenv=1.0.1
|
python-dotenv==1.0.1
|
||||||
|
|
Loading…
Reference in a new issue