![]() |
Executing a MySQL Stored Procedure with variable - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Executing a MySQL Stored Procedure with variable (/thread-5917.html) |
Executing a MySQL Stored Procedure with variable - UtiliseIT - Oct-28-2017 Hi, Newbie here just trying to get a simple insert SP that requires 1 parameter (called BrandandRetailer) with PyMySQL. Cant quite get the syntax right and was hoping for some assistance. Followed https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-callproc.html but she is still not working. Lambda says name 'sql' is not defined: NameError with conn.cursor() as cursor: # Call Stored Procedure args = [(event['BrandandRetailer'],)] result_args = cursor.callproc('IH_SP_AddBrandAndRetailer', args) cursor.execute(sql,) # connection is not autocommit by default. So you must commit to save # your changes. conn.commit()Thanks in advance for any assistance. Todd |