πŸ’­ Read a Range of Data - LIMIT and OFFSET - SQLModel ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ !https://sqlmodel.tiangolo.com/tutorial/limit-and-offset/ Date: January 12, 2024 Image: Read a Range of Data - LIMIT and OFFSET - SQLModel β€” SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. Read a Range of Data - LIMIT and OFFSET - SQLModel SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. sqlmodel.tiangolo.com Today I was running some sqlmodel queries through the sqlalchemy orm. Admittedly I’ve not done enough orm queries before, and I’ve done quite a bit of raw sql. I was trying to get objects from two separate models that had relationships setup. ``` session.query(User, Images).where(User.id == 3).all() ``` It is incredibly slow, and gives me the following warning. ``` SELECT statement has a cartesian product between FROM element(s) ``` What I learned from the SQLModel docs is that you should give it a join to correct this and go much faster. ``` session.query(User, Images).join(Images).where(User.id == 3).all() ``` NOTE β”‚ This post is a thought . It’s a short note that I make about someone else’s content online #thoughts