I'm trying to query a database with the following code:
def check_entry(self, contest_id, number):
print("Contest id: {0}, Number: {1}".format(contest_id, number))
self._db_cursor.execute("""SELECT * FROM Entry WHERE ContestID LIKE ? AND Number Like ?""",
(contest_id, number))
row = self._db_cursor.fetchone()
if row:
return row
else:
return None
This had been consistently working, but I changed seemingly unrelated things in the code, and now I'm receiving this error:
pypyodbc.ProgrammingError: (u'42000', u'[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type image is invalid for argument 2 of like function.')
The error message is straightforward enough, but nothing of datatype image should have been near this function. Originally I was passing an object which did have image data attached. I put a break point in the code and verified that the contest_id and number properties on the object were the correct datatypes. They were, but to be safe I passed them in separately (unattached to an object), and also printed them to the console. Neither are datatype image when the error occurs (or ever), which is why I'm totally lost for how to fix it. Does anyone know the possible cause of this?
EDIT: I've updated the following line:
self._db_cursor.execute("""SELECT * FROM Entry WHERE ContestID LIKE ? AND Number Like ?""",
(int(contest_id), int(number)))
and the error is still occuring. There's a close to 0% chance image data is being passed to this. Even then image data that does exist is varbinary(max) since image datatype is deprecated.