'Python SQLite3- Query return an empty list even if the searched row is present

I can't understand why this function print an empty list. Main is passing start = 'London' and end = 'Rome'

def get_trip_with(self, Start, End):
     list = []
     with sqlite3.connect(db_file) as conn:
          cursor = conn.cursor()
          cursor.execute(str("SELECT * FROM trip WHERE From_where IN (?,?) AND To_where IN (?,?)"),\
                    (Start, End, Start, End,))
          print(f'{(cursor.fetchall())}')

Because if i separate the query into 2 different ones like:

def get_trip_with(self, Start, End):
     list = []
     with sqlite3.connect(db_file) as conn:
          cursor = conn.cursor()
          cursor.execute(str("SELECT * FROM trip WHERE From_where IN (?,?)"),\
                    (Start, End,))
          print(f'{(cursor.fetchall())}')
          print(f'{(cursor.fetchall())}')
          cursor.execute(str("SELECT * FROM trip WHERE To_where IN (?,?)"),\
                    (Start, End,))
          print(f'{(cursor.fetchall())}')

I end up with a bunch of trip including one (found by both queries) from London to Rome. The question is why the first query (script 1) can't find this trip(from London to Rome) but the queries in the second script can? Is there something i'm missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source