Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 644b560

Browse files
authored
Add files via upload
1 parent dbb8b62 commit 644b560

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

python_stored_procedure/python_sp.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import pymysql
2+
from werkzeug import generate_password_hash, check_password_hash
3+
4+
try:
5+
conn = pymysql.connect(host='localhost', database='roytuts', user='root', password='')
6+
cur = conn.cursor()
7+
_hashed_password = generate_password_hash('secret')
8+
cur.callproc('sp_createUser',('Soumitra Roy','[email protected]',_hashed_password))
9+
data = cur.fetchall()
10+
if len(data) is 0:
11+
conn.commit()
12+
print('User information saved successfully !')
13+
else:
14+
print('error: ', str(data[0]))
15+
except Exception as e:
16+
print(e)
17+
finally:
18+
cur.close()
19+
conn.close()

python_stored_procedure/readme.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can read tutorial https://www.roytuts.com/call-stored-procedure-using-python/

0 commit comments

Comments
 (0)