473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Python not getting data from SQL Server

I'm trying to fetch a table from MS SQL Server into Pandas but I get the error:

ProgrammingError: ('ODBC SQL type -151 is not yet supported. column-index=3 type=-151', 'HY106')


Expand|Select|Wrap|Line Numbers
  1. import pandas
  2. import pyodbc
  3.  
  4. cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};"
  5.                       "Server=localhost;"
  6.                       "Database=AdventureWorks2012;"
  7.                       "Trusted_Connection=yes;")
  8. cursor = cnxn.cursor()
  9. sql = cursor.execute('SELECT * FROM HumanResources.Employee')
  10.  
  11. df = pandas.read_sql(sql, cnxn)
  12.  
  13. cursor.close()
  14. cnxn.close()
Aug 18 '17 #1
1 4232
dwblas
626 Expert 512MB
There is no way to tell without a complete error message. The first question is always, does your user have permission to access the database and is there a password? The docs for pyodbc are at https://github.com/mkleehammer/pyodbc/wiki
Aug 18 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bowen Chiu | last post by:
Dears: I use a 4KBytes HTML content to do this benchmark, it is just a simple test of python based web server. mod_python with Apache Lifting the server siege... done. Transactions: ...
9
by: Doug | last post by:
I am thinking of using a Python based HTTP server instead of Apache. I would be interested in one that employed generators and coroutines. I know those are fairly new features of python, so...
7
by: ajikoe | last post by:
How can python connect to server which use SSH protocol? Is it easy since my python has to run third party vendor, write data, read data inside the server (supercomputer). Any suggestion? ...
15
by: John Salerno | last post by:
Can anyone tell me how complicated it might be to install Python on my server so I can use it for web apps? Is it a one-time process, or something to maintain? Thanks.
9
by: nickyeng | last post by:
Hi My case is i get the error on runtime while getting data from a file. i get this error: Record of 12344 is found! 5 testing 4272 _cygtls::handle_exceptions: Error while dumping...
0
by: Martin84 | last post by:
Hi all, im building a small personal website but know next to nothing about servers and hosts. After running a few searches I found lots of hosts (decided on a 1&1.co.uk package) but next to nothing...
4
by: dfent | last post by:
I'm using MS Access 2003 1 form with 7 sub forms, updating 7 tables. I've split my database but still getting data changes error messages when multiple people are in the database. Any help would be...
6
by: bushwacker | last post by:
Hello all, I'm a chemical engineering student. our teacher has given us a project to do some calculations based on some equations. those equations include constants, which are to be read from a...
3
by: Yusniel | last post by:
Hi friends. Someone know how to work with python and exchange server?.
5
by: abhi3211 | last post by:
i am using java inside java script page. in that page i want to use two dropdown list. in first dropdown list i am getting data from ms-access database. in second dropdown list i want to get data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.