You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the /farms endpoint includes the farm.json data alongside every farm. This makes the responses very large, the more farms there are (eg: > 2.5 mb for > 100 farms).
Discussed with @paul121 and decided the easiest thing to do is add an include_info query parameter that must be set in order to include the farm.json data. Exclude it by default.
The text was updated successfully, but these errors were encountered:
@mstenta and I chatted more about this in chat. We decided that an include_info query param isn't the best API design choice. Instead, we're only including the farm.info property on requests to /farms/{farm_id}.
This means that there is no way to get the farm.info property for ALL farms in a single request. Until there is a use case for this, we're removing this functionality from the API.
For now, it was super easy to trim farm.info into a separate FastAPI response model (Pydantic schema) that is only used on the /farms/{farm_id} endpoint. I also added deferred loading to the info column on the SQLAlchemy model so that the info property is not always selected from the DB.
@mstenta originally we discussed moving farm.info to a separate DB table. I started down this path... and then realized it would be rather complicated because we're using a JSONB column. This is because the new table would still need a top-level info column, as opposed to many columns for each set of data that returned from farm.json. This means the resulting structure returned via API would be farm.info.info.{farm.json keyword} - perhaps in the future once we have a need to better-structure the farm.info properties we can migrate away from a JSONB column, and have a true farm_info table.
Currently the /farms endpoint includes the farm.json data alongside every farm. This makes the responses very large, the more farms there are (eg: > 2.5 mb for > 100 farms).
Discussed with @paul121 and decided the easiest thing to do is add an
include_info
query parameter that must be set in order to include the farm.json data. Exclude it by default.The text was updated successfully, but these errors were encountered: