I am unable to create a SQL Server stored procedure using Python's pyodbc. The command executes correctly and I get no error message however the stored procedure does not appear on the server
import pyodbc
host = 'myServer'
database = 'model'
conn = pyodbc.connect(
r'DRIVER={SQL Server Native Client 11.0};' +
r'SERVER=' + host + ';' +
r'DATABASE=' + database + ';' +
r'Trusted_Connection=yes'
)
cursor = conn.cursor()
sql = """
CREATE OR ALTER PROCEDURE [dbo].[Test] AS
SELECT 1
"""
cursor.execute(sql)
conn.close()