I try to parametrize number of top rows to get from table.
I tried it with
db.cursor.execute( \'\'\' SELECT TOP ? VALUE FROM mytable
You can use string formatting for the TOP (and a proper parameter for the WHERE) provided that top_limit is an int so there is very little danger of SQL Injection issues.
top_limit
int