Python Forum
Add a stored procedure with variable using MySQL Connector
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add a stored procedure with variable using MySQL Connector
#1
Hi, Im using the Python MySQL Connector to fire a stored procedure with a variable.

Thanks to the awesome help in this forum my working version of an insert is

query = ("SELECT distinctrow UPC, ItemFriendlyNames, ItemName, Brand, Model, Retailer, ItemID FROM my.view where ItemFriendlyNames like "%(pSearch)%" order by UPC, Model, Retailer")
data = (event['pSearch'],)
         
cursor.execute(query,data)
rows = cursor.fetchall()
What I need to do is fire stored procedure sp_showitemswithSearch that recieves an input called pSearchTerm

Ive tried to format based on the select query and also tried callproc but can't quite seem to get either format right.

Thanks in advance

Todd
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python script is hanging while calling a procedure in database prasanthi417 4 444 Jan-17-2024, 02:33 PM
Last Post: deanhystad
  Mysql and mysql.connector error lostintime 2 612 Oct-03-2023, 10:25 PM
Last Post: lostintime
  python call stored procedure mg24 2 1,032 Oct-18-2022, 02:19 AM
Last Post: mg24
  python call stored procedure with two parameter mg24 4 1,405 Sep-27-2022, 05:02 AM
Last Post: deanhystad
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,684 Feb-09-2022, 09:55 AM
Last Post: ibreeden
Question Debian 11 Bullseye | Python 3.9.x | pip install mysql-connector-python-rf problems BrandonKastning 4 6,574 Feb-05-2022, 08:25 PM
Last Post: BrandonKastning
  mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python ilknurg 3 5,467 Jan-18-2022, 06:25 PM
Last Post: ilknurg
  Program stuck at mysql.connector.connect zazas321 1 2,040 Jul-29-2021, 10:49 AM
Last Post: zazas321
  MYSQL.CONNECTOR ERROR DB1 8 3,776 Jul-23-2021, 03:31 AM
Last Post: DB1
  Defining an object's argument whose name is stored in a variable arbiel 2 2,146 Dec-11-2020, 10:19 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020