Python Forum
python call stored procedure - 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: python call stored procedure (/thread-38469.html)



python call stored procedure - mg24 - Oct-17-2022

Hi Team,

Need help how to call stored procedure via python.

I am using pyodbc libarary.

query = """EXEC[DBS_database].[dbo].[sp_Recon] 'Table1','database1'"""

Cursor.execute(query)  its not working. **wall** 
for row in cursor.fetchall():
	print(row)



RE: python call stored procedure - Larz60+ - Oct-17-2022

Questions:
  1. Which DBMS are you using?
  2. Your query looks like a candidate for SQL injection attack.



RE: python call stored procedure - mg24 - Oct-18-2022

Hi Team,

my stored procedure is working now. I will share the code soon.

Actually issue was in stored procedure output was not written.



Thanks
mg