How to get the top frequency

I have model

class RawFrequencyDicts(Base):
    __tablename__ = "raw_frequency_dicts"
    id = Column(types.UInt64, primary_key=True)
    item = Column(types.String)
    lemmatized_text = Column(types.String)
    lemmatized_text_no_ordered = Column(types.String)
    frequency = Column(types.Int64)
    count_words = Column(types.Int64)
    mark_up = Column(types.Int64)
    domain_id = Column(types.Int64)
    language = Column(types.String)
    run = Column(types.Int64)
    run_desc = Column(types.String)
    created_at = Column(types.DateTime)
    updated_at = Column(types.DateTime)
    __table_args__ = (engines.MergeTree(),)

And I have a choice of size. For example, when choosing 1000, I should get the top 1000 in frequency.

Now I have a choice on the frequency itself.

query_db = query_db.filter(model.frequency == int(params.frequency))
Back to Top