---
title: "Read a Range of Data - LIMIT and OFFSET - SQLModel"
description: "!https://sqlmodel.tiangolo.com/tutorial/limit-and-offset/?h=#combine-limit-and-offset-with-where"
date: 2023-08-01
published: true
tags:
  - python
  - thought
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://sqlmodel.tiangolo.com/tutorial/limit-and-offset/?h=#combine-limit-and-offset-with-where" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">Read a Range of Data - LIMIT and OFFSET - SQLModel</div>
      <div class="embed-card-description">SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.</div>
      <div class="embed-card-meta">sqlmodel.tiangolo.com</div>
    </div>
  </a>
</div>


Implement paging in sqlmodel with where, limit, and offset.

``` python
def select_heroes():
    with Session(engine) as session:
        statement = select(Hero).where(Hero.age > 32).limit(3)
        results = session.exec(statement)
        heroes = results.all()
        print(heroes)
```
