Fetch data from sql database using Pypdbc package

I have a streamlit app that retrieve data from sql server database where i am using pyodbc.

I have an select query where i try to select data based on user input using wild card inside the sql query.

The problem is that when the user search on any field beside the ID it does not return anything.

database:

CREATE TABLE [dbo].[t1](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[first] [nvarchar](50) NULL,
	[last] [nchar](50) NULL,
	[Rating] [int] NULL,
 CONSTRAINT [PK_t1] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

python code:

import pandas as pd 
import streamlit as st

advanced_search_term_list = []

if len(advanced_search_term_list)>0:

   sql="select * from testDB.dbo.t1 where (ID = ? OR ID is null) and (first LIKE  ? OR first is null) and (last LIKE ? or last is null) and (Rating = ? or Rating is null) "   

   param0=advanced_search_term_list[0]

   param1=f'%{advanced_search_term_list[1]}%'

   param2=f'%{advanced_search_term_list[2]}%'

   param3=advanced_search_term_list[3]

   rows = cursor.execute(sql,param0,param1,param2,param3).fetchall()

the query just return data of the param0

where is the error in my code ??

It appears this is being answered here:

no it return just the first column what i want is to return all the column of the record.

Right, but someone is trying to answer it there was my point. I don’t know anything about sql server, but hopefully someone comes along who does.

This reply is out of scope of this question but can you take a look at this problem because its very disappointing that i want to upgrade streamlit to version 1.0 but because of the problem *ArrowInvalid
I am stuck in version 0.84
The topic link is : ArrowInvalid