May 03 2023
07:36 AM
- last edited on
Mar 05 2024
02:40 PM
by
TechCommunityAP
May 03 2023
07:36 AM
- last edited on
Mar 05 2024
02:40 PM
by
TechCommunityAP
Hello. I have a simple Python script that updates a SQL database and I am running that script in my Azure DevOps release pipeline. I used the classic editor and created a Command Line Script step to install the pyodbc module needed for my Python script to run. I have a second step that runs the Python inline script, but that step fails with this error:
import pyodbc <<<<<THIS IS THE LINE THAT I GET THE ERROR ON
cnxn = pyodbc.connect('Driver={ODBC Driver 18 for SQL Server};Server=tcp:myserver,myport;Database=mydb;Uid=myuser;Pwd=mypwd;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;')
cursor = cnxn.cursor()
cursor.execute("INSERT INTO Names (ID, Name) VALUES ('0019', 'TEST')")
cnxn.commit()
Thank you for your help!
May 03 2023 10:45 AM
May 03 2023 11:03 AM