Trying to pass params to a simple SELECT query :
query = """SELECT * from tbl_tab where name in {};"""
I went through this code to manipulate my dataframe and the idea is to be able to pass 1 to n params into my query :
conn = pyodbc.connect(conx_string)
t = tuple(["N","M"])
crsr = conn.cursor()
data = crsr.execute(query.format(t))
rows = [list(x) for x in data]
columns = [column[0] for column in crsr.description]
df = pd.DataFrame(rows, columns=columns)
And I got the expected result. However, when passing a single param to t : having t = tuple(["N"])
I got the error
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'. (102) (SQLExecDirectW)")
Any idea please ?