Skip to content
Advertisement

Tag: pyodbc

Inser list of ids into table aioodbc (pyodbc)

I am using aioodbc which is basically async pyodbc. My table has only one columns ClaimID. I am trying to do bukl insert list of ids like [1, 2, ,3 ,4 ,5 ,6 … n] (up to 21k) where ids is a python list of ints. I am getting error How to perform bulk insert of list of ids ?

How to access particular elements of a dataframe in Pandas. Gives error

I have a dataframe df_params. It contains parameters for the stored procedure. I simply want to access the elements of the dataframe in a loop: But it gives me an error without really explanation: The goal is to supply value to the stored procedure: desired outcome from print(query): Answer pandas.DataFrames don’t behave exactly like numpy.ndarrays. There are basically three options:

Test Connection pyodbc (Python and SSMS)

I’m trying to follow some simple steps in this Microsoft doco but I can get it to connect. What am I doing wrong? This is the error message: PS C:UsersNelson.Silva> & Answer You changed your code before posting. In the code block you say the connect line is but in the exception block the line is: The problem is not

pyodbc legacy-install-failure in ubuntu python 3.9

I am not being able to install pyodbc Sorry for the image, but it is on a private network and it does not allow me to do a copy-paste I saw solutions like this, but it is for windows. I can’t downgrade my python 3.9 either. Do you know a solution for this pyodbc installing? Answer Had the same issue

Can python cursor.execute accept multiple queries in one go?

Can the cursor.execute call below execute multiple SQL queries in one go? I don’t have python setup yet but want to know if above form is supported by cursor.execute? Answer Multiple SQL statements in a single string is often referred to as an “anonymous code block”. There is nothing in pyodbc (or pypyodbc) to prevent you from passing a string

Does not detach database by sp_detach_db in pyodbc

I am trying to detach the database, but for some reason it does not detach with no error, am I missing something? SQLServer 2012 version: 11.0.2100 pyodbc version: 4.0.31 Answer Thx for Gord Thompson for the tip. Fixes: SET SINGLE_USER WITH NO_WAIT -> SET TRUSTWORTHY ON Remove from connect params “Trusted_Connection=yes;”, It associates the system user instead of “sa” user.

Advertisement