I have written an object to connect and execute my Snowflake queries:
class snowflake_conn(object):
#some other methods...
#execute method
def execute(self, sql, bindvars=None):
try:
if bindvars is None:
self.cursor.execute(sql)
else:
self.cursor.execute(sql, bindvars)
except Exception:
raise
Then I tried binding the variables:
conn.execute("""
with result as (select * from db.schema.tbl where transaction_date >= :1 or delivery_date >= :1)
select * from result
""", (last_month_date,))
It keeps giving me error TypeError: not all arguments converted during string formatting. I followed the binding variables here: https://docs.snowflake.com/en/user-guide/python-connector-example.html#binding-data
I have tried using ? and adding extra (last_month_date, last_month_date) to no avail. Any idea how I could fix this would be much appreciated.
Thank you beforehands.
Edit: added trailing comma in the binding and still same error.