Home>

I have an Info table, when a certain number of entries are reached, I want to delete the very first entry.

Table:
    class Info(TimedBaseModel):
        __tablename__= 'information'
        id= Column(BigInteger)
        info= Column(String(200))
        query: sql.Select

Is there any way to change this code so that it only removes the first element? It completely clears the entire table:

await Info.delete.where(message.from_user.id== Info.id).gino.status()
  • Answer # 1

    Sort of.

    info= await Info.query.gino.first()
    await info.delete()