I'm working on a database using sqlite3 for Python that stores addresses. I understand that you use ?
as a placeholder and you give the execute
method a tuple or list of values to fill the placeholders. I am also aware that None
should correspond to sqlite's NULL
value.
However, if I try to SELECT
from the table like so, even though this entry does exist in the table, it does not fetch any values:
cursor.execute('SELECT * FROM test WHERE (address, apartment, city, state) = (?, ?, ?, ?);',
('123 Front St', None, 'Springfield', 'WA'))
However, if the apartment is not a NULL
value, and I give it a regular old string for the apartment, it will fetch it just fine.
What am I doing wrong?