ANIALLATOR114 / SimplyTransport

SimplyTransport - API - Website - Ingesting and presenting Transport Information
https://simplytransport.ie
Apache License 2.0
2 stars 3 forks source link

Create indexes #130

Closed ANIALLATOR114 closed 2 months ago

ANIALLATOR114 commented 2 months ago

Summary by Sourcery

Introduced indexes on the created_at columns for the rt_stop_time and rt_trip tables to improve query performance. Removed redundant logging and simplified the query logic in the get_realtime_schedules_for_trips method.

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request introduces indexes on the created_at columns of the rt_stop_time and rt_trip tables to improve query performance. The changes include updating the model definitions to include the indexes and creating a new Alembic migration script to apply these changes to the database. Additionally, the repo.py file has been refactored to remove redundant code and logging, and to add a filter to limit query results to the last two hours.

File-Level Changes

Files Changes
SimplyTransport/domain/realtime/stop_time/model.py
SimplyTransport/domain/realtime/trip/model.py
migrations/versions/c6fd373f53c5_created_at_indexes.py
Added indexes on the created_at columns of rt_stop_time and rt_trip tables and created a corresponding Alembic migration script.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.