retrieval_service/datastore/providers/spanner_gsql.py [755:799]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                },
            )

        # Convert query result to model instance using model_validate method
        flights = [
            models.Flight.model_validate(
                {key: value for key, value in zip(self.FLIGHTS_COLUMNS, a)}
            )
            for a in results
        ]

        return flights, None

    async def search_flights_by_airports(
        self,
        date: str,
        departure_airport: Optional[str] = None,
        arrival_airport: Optional[str] = None,
    ) -> tuple[list[models.Flight], Optional[str]]:
        """
        Search for flights by departure and/or arrival airports.

        Args:
            date (str): The date of the flights in 'YYYY-MM-DD' format.
            departure_airport (str, optional): The departure airport code. Defaults to None.
            arrival_airport (str, optional): The arrival airport code. Defaults to None.

        Returns:
            list[models.Flight]: A list of Flight model instances matching the search criteria.
        """
        with self.__database.snapshot() as snapshot:
            # Spread SQL query for readability
            query = """
                SELECT * FROM flights
                WHERE (@departure_airport IS NULL OR LOWER(departure_airport) LIKE LOWER(@departure_airport))
                AND (@arrival_airport IS NULL OR LOWER(arrival_airport) LIKE LOWER(@arrival_airport))
                AND cast(departure_time as TIMESTAMP) >= CAST(@datetime AS TIMESTAMP)
                AND cast(departure_time as TIMESTAMP) < TIMESTAMP_ADD(CAST(@datetime AS TIMESTAMP), INTERVAL 1 DAY)
                LIMIT 10
            """

            # Execute SQL query with parameters
            results = snapshot.execute_sql(
                sql=query,
                params={
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



retrieval_service/datastore/providers/spanner_postgres.py [757:802]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                },
            )

        # Convert query result to model instance using model_validate method
        flights = [
            models.Flight.model_validate(
                {key: value for key, value in zip(self.FLIGHTS_COLUMNS, a)}
            )
            for a in results
        ]

        return flights, None

    async def search_flights_by_airports(
        self,
        date: str,
        departure_airport: Optional[str] = None,
        arrival_airport: Optional[str] = None,
    ) -> tuple[list[models.Flight], Optional[str]]:
        """
        Search for flights by departure and/or arrival airports.

        Args:
            date (str): The date of the flights in 'YYYY-MM-DD' format.
            departure_airport (str, optional): The departure airport code. Defaults to None.
            arrival_airport (str, optional): The arrival airport code. Defaults to None.

        Returns:
            list[models.Flight]: A list of Flight model instances matching the search criteria.
        """
        with self.__database.snapshot() as snapshot:
            # Spread SQL query for readability

            query = """
                SELECT * FROM flights
                WHERE (COALESCE($1) IS NULL OR LOWER(departure_airport) LIKE LOWER($1))
                AND (COALESCE($2) IS NULL OR LOWER(arrival_airport) LIKE LOWER($2))
                AND CAST(departure_time as timestamptz) >= CAST($3 AS timestamptz)
                AND cast(departure_time as timestamptz) < spanner.timestamptz_add(CAST($3 AS timestamptz), '1 day')
                LIMIT 10
            """

            # Execute SQL query with parameters
            results = snapshot.execute_sql(
                sql=query,
                params={
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



