Getting error when running sql server query in Python -


i building web app using django framework of python , db sql server azure ,using pyodbc.

i have issue unable resolve , getting parameter(file_name) string , when running query parameter getting empty results in first case and

  "sql = sql % tuple('?' * len(params))             typeerror: not arguments converted during string formatting" 

in 2nd case , doing wrong?

file_name=request.post.get('filetodelete')     connections['default'].cursor() c:        1st case           parms=[file_name]           sql='select *  banks_row_data file_name=%s'           c.execute (sql,parms)           test=c.fetchall()       2nd case           c.execute (sql,file_name)           test=c.fetchall() 

pyodbc uses ? parameter placeholder, not %s.

sql = 'select *  banks_row_data file_name = ?' 

note though since using django should using django model layer fur kind of query.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -