I'm trying to retrieve the data from database and save into pandas.DataFrame. Here is my Python script,
conn = pyodbc.connect(sql_server)
query = '''SELECT a1, a2, a3
FROM ''' + dbschema + '''.SomeResults
WHERE FactorName = \' ''' + FactorName + ''' \' AND parametername = 'Param1' ORDER BY Factor1 '''
df = pd.read_sql(query, conn)
print(df)
However, it returns,
Empty DataFrame
Columns: [a1, a2, a3]
Index: []
I'm pretty sure it's not SQL problem, as I can retrieve the data from database using conn.cursor().