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
0 answers

[Python to MS SQL]: Alternative to DataFrame.to_sql without using sqlalchemy.create_engine() and using pypyodbc

Scenario: 1.I am trying to insert the dataframe directly into SQL Table. engine_azure = sqlalchemy.create_engine(sqlchemy_conn_str,echo=True,fast_executemany = True, poolclass=NullPool) conn =…
Rahul
  • 21
  • 7
1
vote
0 answers

Python (pandas) Query Data Frame from SQL Server database error

I am trying query python data frame from a SQL Server database and I am getting an error. I think error is SQL syntax is too long? But I don't know where it is wrong. FUNCTION import dash import dash_bootstrap_components as dbc import…
joshyu
  • 11
  • 2
1
vote
0 answers

AWS lambda unable to find ODBC Library while using pypyodbc

I'm trying to make the connection to sqlserver using pypyodbc library, but my lambda throws following error module initialization error: 'ODBC Library is not found. Is LD_LIBRARY_PATH set?' Is there something i need to upload to layer apart from…
1
vote
1 answer

Python/SQL/pydobc: Get result of if operation for counter?

I'm running the following code to add emails to a database table if they do not already exist. I'd like to be able to count the emails that are added and the ones that already existed. import pyodbc emails = [# a list of emails] new_count =…
Danny
  • 470
  • 1
  • 4
  • 21
1
vote
1 answer

Retrieving and printing a value from an Access database

I'm trying to retrieve and print a row from an Access database. I want the user to input an ID and a field then a value to be printed. This is my code so far... import pypyodbc import pandas conn = pypyodbc.connect(r'Driver={Microsoft Access Driver…
Ben Ranft
  • 25
  • 4
1
vote
1 answer

How to insert data into unique identifier column into SQL Server using pyodbc

I have a table that has a column of type uniqueidentifier. How do I insert the data into uid columns using pyodbc? I am trying this code: cursor.execute(""" Insert into tablename (col1,col2) values (?,?) …
Meraj Hussain
  • 329
  • 1
  • 6
  • 24
1
vote
1 answer

How can i access Views instance of Tables in ODBC using pyodbc

I want to access my database by using python script . I can able to access all table by using SELECT * FROM poorvika1.payment; But i want to access the query by using VIEW Statement SELECT * FROM poorvika1.pymentview; This is my python script import…
Boxer Robert
  • 1,169
  • 2
  • 8
  • 14
1
vote
0 answers

“Associated statement not prepared” caused by pypyodc?

What - Error Message (‘HY007’, [HY007][ODBC SQL Server Driver] Associated statement Is not prepared. I downloaded ODBC to better diagnose this error based off other posts, however it is still throwing the same error What is the actually error here…
Justink
  • 27
  • 6
1
vote
2 answers

How to call SQL Server stored procedure with so many parameters in python?

I have to insert records in a db table with more than 50 columns. I know how to call stored procedure with parameters in Python like this: self.__createConnection() proc= "{call faftech..Hns_HolidayCheck (?)}" ls=[] ls.append(dateTime) …
Vivek Mishra
  • 1,772
  • 1
  • 17
  • 37
1
vote
1 answer

Is there a way with pandas to use read_sql() with an sql-statement, that takes multiple variables?

this is a part of my code. I already have a database with values in it, and need to create a new dataframe based on the values out of this dataframe (at the moment these values are only 12 & 13, stored in the header_row_ids variable). When I run the…
Civan Öner
  • 65
  • 1
  • 8
1
vote
1 answer

SQL Server encoding of column names with pypyodbc

I am trying to connect Python with a SQL Server database using pypyodbc. When I get the cursor.description for obtaining the column names of the tables I get the following: u'\u6573\u7373\u6f69\u496ed' but I have this string in SQL Server:…
cdwcew
  • 13
  • 3
1
vote
1 answer

Update query using python odbc cursor - Not working

I have this query executed with the following snippet: cursor2.execute("UPDATE datatable SET data1 = ?, data2 = ?, data3 = ? WHERE id = ?",[d1,d2,d3,i]) print("affected rows = {}".format(cursor2.rowcount)) Affected rows returns 1 but row in…
Rav
  • 1,327
  • 3
  • 18
  • 32
1
vote
1 answer

How do I prevent NULLs from causing the wrong datatype in a Dataframe?

I am using Pandas "read_sql" to pull a data set from SQL Server into a dataframe, using Pypyodbc. However, it looks like sometimes (NOT ALWAYS), when there are NULLs in a field, the datatype isn't int64, but float64. I have two fields that are…
mbourgon
  • 1,286
  • 2
  • 17
  • 35
1
vote
1 answer

Chinese character insert issue

I have the following dataframe in pandas need to insert all value into a datawarehouse with chinese characters but chinese characters are instered as junk (?????) (百å¨è‹±åšï¼ˆèˆŸå±±ï¼‰å•¤é…’有é™å…¬å¸ ) like above one The insert query is…
1
vote
2 answers

How to fetch bytes from SQL Server Database and Convert to Image in Python

-- I'm loading test data into my SQL Server Database using python and was able to successfully take images and break them down into bytes and store them in the database, but when trying to fetch back the bytes and decode it to save it as a new…
benfsmith3
  • 21
  • 1
  • 4