This is something for Python Flask developers.
While developing application we usually come across the situation where data fetch is little slow and it is not working as expected. If we are fresher in any kind of Database technologies then we might think that OHH, it is more data(probably max 2K products from single table which only has plain data, no Images or such that and having total of 2K records) and it can be slow. But once you are little experienced you would know that something is missing. First thing that needs to be checked on such scenarios that are you reading any other whole table?(i.e. if you want user specific products, are you reading whole product table, whole user table and then filtering in python or you are doing proper joins?), second thing that needs to be looked at indexes, are they required, if so then create it.
Any ways that theory was for fresher but for how to create constraints and indexes using SQLAlchemy, please look at this link.