Skip to content

Tag: pyodbc

Data is not inserted MSSQL Python

I am doing a python script to add text files into an MSSQL table. Using pyodbc, I’m doing it. The data is not inserted in the result. There is no error showing when running. Here is my code, Answer You’re missing a call to cnxn.commit() after the loops are done.

Pyodbc and AWS Lambda

I have a fairly simple SQL query that’s taking forever to run in my Lambda function and I don’t know why. I know OR statements can be a killer in SQL, but in my database editor, it runs in about 800ms. Why would it take longer in a Lambda function? I’m using cursor.execute() and passing the …

Passing parameters from Python to SQL Server

I have code like this: I am getting this error: ‘The SQL contains 1 parameter markers, but 2 parameters were supplied’, ‘HY000’ Is there any way to pass this parameter? I don’t want to create a dynamic array by concatenation. Is there any way to name the parameter marker inside t…

Issue connecting to SQL Server via Python pyodbc

I have an ongoing issue that I just can’t solve. It concerns a Python script that loads data into a SQL server database. When I run it from my local machine it works fine, however when I run the same script from a server I get the following error: conn = pyodbc.connect(r’Driver={SQL Server};&#8217…

Problems passing a Python String to SQL query

I got some issues passing my SQL query made in Python to MS SQL. Were talking about retrieving some code via pyodbc, editing it with regex, and passing it back into a new table of the Database. I also tried some print()-Commands to assure the Code is running in Python and being edited the right way, but I am …