Connecting to Sql Server with Python 3 in Windows

纵饮孤独 提交于 2019-12-09 01:02:05

问题


Can someone please point me in the right direction of how I can connect to MS SQL Server with Python? What I want to do is read a text file, extract some values and then insert the values from the text file into a table in my Sql Server database. I am using Python 3.1.3, and it seems some of the modules I have come across in research online are not included in the library. Am I missing something? Is there a good 3rd party module I should know about. Any help would be greatly appreciated.I am using Windows. thanks


回答1:


There are a bunch more SQL Server libraries listed on the Python wiki. At least mxODBC is fully ready for Python 3.1, but I haven't used it so I can't comment on its appropriateness...




回答2:


There is a pymssql module. Here you can find installation instructions




回答3:


I found a module called CEODBC that I was able to use with Python 3 after doing some research. It looks like they will also be releasing a Python3 compatible version of PYODBC soon. Thanks for all your help.



来源:https://stackoverflow.com/questions/6154069/connecting-to-sql-server-with-python-3-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!