Questions tagged [pypyodbc]

pypyodbc is a pure Python ODBC interface module. (Not to be confused with pyodbc, which performs many of the same functions but was written as an *extension module* in C++.)

pypyodbc is a pure Python interface module. It is very similar to , which performs many of the same functions but was written as an extension module in C++.

In addition to being a very good ODBC Library in its own right, pypyodbc is a useful alternative to pyodbc in situations where pyodbc encounters difficulties.

For more information, see

pypyodbc - A Pure Python ODBC Library

Installation is available from pip:

pip install pypyodbc

Or by downloading installation package. (Unzip, navigate to folder, and run:)

python setup.py install
285 questions
1
vote
1 answer

"Error Locating Server/Instance Specified" when connecting to SQL Server

I'm using python 2.7 have the code below to connect sql instances class SqlConnector: def __init__(self, driver, sqlserver_ip, database, **kwargs): if 'port' in kwargs: conn_string = 'DRIVER='+ driver + ';SERVER='+…
Jervis Lin
  • 151
  • 1
  • 3
  • 11
1
vote
1 answer

INSERT query is not executing from the python listing but executes pretty fine from MSSQL Management studio

I am trying to execute a simple INSERT query to MSSQL Server using the pypyodbc library in python. If I try to execute SELECT Country, City, Street, House, Zipcode, Date FROM postal_test_db.dbo.addresses from the Microsoft SQL Management Studio it…
1
vote
0 answers

uploading pandas dataframe into MS Access with pypyodbc -- do I need an engine?

I'm new to SQL but OK with working things out in python. I use pandas to read a data frame I call "lp" and fix the columns so that they match my Access table called "full" in my file "all lp.accdb". I want to append the entirety of "lp" to "full." …
atl
  • 11
  • 2
1
vote
1 answer

error when inserting dataframe into MS-SQL with Python

I want to insert a pandas dataframe into MS-SQL using pypyodbc. Here is my code: Create a dataframe at first: df = pd.DataFrame({'C1': [11, 21, 31], 'C2': [12, 22, 32], 'C3': [13, 23, 33]}) tablename = tb and…
potatout
  • 187
  • 1
  • 11
1
vote
1 answer

Pandas attribute names with pypyodbc on centos return in Chinese

I am trying to connect using pypyodbc and pandas to a postgres DB. I am using Python 2.7 on a Centos 7 machine. import pypyodbc import pandas as pd conn = pypyodbc.connect("Driver={PostgreSQL};Server=xxx;Port=xxx;Database=xxx;Uid=xxx;Pwd=xxx;") cur…
Roee Anuar
  • 3,071
  • 1
  • 19
  • 33
1
vote
1 answer

pypyodbc execute returns list index out of range error

I have a function that runs 3 queries and returns the result of the last (using the previous ones to create the last) when I get to the 3rd query, it get a list index our of range error. I have ran this exact query as the first query (with manually…
1
vote
1 answer

MSSQL data insertion with Python and pypyodbc - Params must be in a list, tuple

I'm attempting to write (I can read fine) values to a MSSQL instance. My code resembles: import pypyodbc lst = ['val1', 'val2', 'val3'] connection = pypyodbc.connect(...) cursor = connection.cursor() cursor.executemany("INSERT INTO table (a, b,…
Zach Cleary
  • 458
  • 1
  • 4
  • 17
1
vote
1 answer

PyPyOdbc Correct use of cursor

I use pypyodbc to read data from an ms sql server. I am not sure if the cursor should be closed after any query or just once at the end and I could not find anything in the doc. Example: curs = con.cursor() for id in id_list: curs.execute…
user2735751
  • 33
  • 1
  • 6
1
vote
1 answer

Python: Set param for columns and values pypyodbc - executemany

I have this situation where I created a method that will insert rows in database. I provide to that method columns, values and table name. COLUMNS = [['NAME','SURNAME','AGE'],['SURNAME','NAME','AGE']] VALUES =…
Dragon.M
  • 249
  • 1
  • 4
  • 11
1
vote
1 answer

On Windows with Python and pypyodbc how do you list the drivers available?

For a python script that is shared by many people I need a solution to detect the users driver so I can dynamically construct the connection string. I'm currently using the os environment COMPUTERNAME like: if os.environ['COMPUTERNAME'] ==…
Mattman85208
  • 1,858
  • 2
  • 29
  • 51
1
vote
1 answer

pypyodbc network path not working properly

I'm using Python 3.6.1 and the pypyodbc library to import a .csv file into a local DB in Management Studio. Can anyone tell me why this code would work perfectly fine in Management Studio, but not in my pypyodbc script? The Python script runs…
Matt
  • 967
  • 2
  • 9
  • 23
1
vote
5 answers

Connection string to SQL server with Python pypyodbc

I'm using this connection string but something is wrong. conn = pyodbc.connect (DRIVER={SQL Server};SERVER=localhost;DATABASE=test;UID=YYY;PWD=XXXX) connection.close() How can I do this?
Tal
  • 61
  • 1
  • 2
  • 7
1
vote
0 answers

Error : connecting to Azure SQL DB from VM in Google cloud using pypyodbc

I am having issues connecting to an Azure database from a Virtual Machine running Ubuntu 16.04. This VM is in Google cloud. I get the following error pypyodbc.Error: (u'IM002', u'[IM002] [unixODBC][Driver Manager]Data source name …
Mike
  • 67
  • 1
  • 6
1
vote
1 answer

Updating database using pypyodbc

I am facing challenge in updating Database using pypyodbc module. Not getting any error, code is successfully executed; but SQL-Server DB is not updated. Fetching from DB is happening. Please check: connection = pypyodbc.connect('Driver={SQL…
1
vote
1 answer

Trying to find last insert row ID; returned value is encrypted

I'm using pypyodbc with SQL Server 2016. I am trying to insert and grab the last id inserted into database following another user's remarks but the returned value seems to be encrypted. Is there a way to decrypt it? def executeSQL (command): …
Jay
  • 741
  • 10
  • 26