Lesson - 58 : Python Advanced - Python Database Access : Calling MySQL Stored Procedures in Python

Опубликовано: 16 Январь 2018
на канале: Sada Learning Hub
3,686
17

**************************************************
Python Core PlayList :    • Lesson - 01 : Python3 - What is python  
Python Advanced PlayList :    • Lesson - 46 : Python Advanced - Python OOP...  
**************************************************

Python Database Access : Calling MySQL Stored Procedures in Python :
To call a stored procedure in Python, you follow the steps below:
Connect to MySQL database by creating a new MySQLConnection object.
Instantiate a new MySQLCursor object from the MySQLConnection object by calling the cursor() method.
Call  callproc() method of the MySQLCursor object. You pass the stored procedure’s name as the first argument of the  callproc() method. If the stored procedure requires parameters, you need to pass a list as the second argument to the  callproc() method. In case the stored procedure returns a result set, you can invoke the  stored_results() method of the MySQLCursor object to get a list iterator and iterate this result set by using the  fetchall() method.
Close the cursor and database connection as always.
Example :
db_config = read_db_config()
conn = MySQLConnection(**db_config)
cursor = conn.cursor()
cursor.callproc('find_all')

Sample Projects : https://github.com/SadaLearningHub1/P...


На этой странице сайта вы можете посмотреть видео онлайн Lesson - 58 : Python Advanced - Python Database Access : Calling MySQL Stored Procedures in Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Sada Learning Hub 16 Январь 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 3,686 раз и оно понравилось 17 зрителям. Приятного просмотра!