I regularly use the following strategy to perform SQL queries using a list:
However, if there are too many items in your search list for the SQL server to handle, you may emcounter the following error:
pyodbc.Error: (‘07002’, ‘[07002] [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error (0) (SQLExecDirectW)’)
Breaking it down
Rather than trying to force feed SQL with so many items to search
Where the determine_source_type function is defined as follows: