Is it possible to use Bind variables with Python? I am using sqlanydb latest release and have tried without success each of the methods mentioned here my preferred method is pyformat but this raises error: select something from table where something = %(bindvar)s': b"Syntax error near '%' on line 1" |
This works: sql = "select something from table where something = :bindvar" In pandas use the list method: pd.read_sql(sql, db, params=[bindvar]) |
You can use the question mark format:
|
it seems that this form is supported:
sql = "select something from table where something = '%s'" %strvar
cursor.execute(sql)
This is not ideal as it would leave code open to injection, does it support something as explained here:
http://stackoverflow.com/questions/24408557/pandas-read-sql-with-parameters