pyodbc

Cannot Install Python Modules after Installing Anaconda

↘锁芯ラ 提交于 2019-11-30 23:35:30
[New Note: I cannot install through binstar or anaconda. Why can't I install in python, outside of anaconda? Is there a way to get my computer to stop using the anaconda install of python when I don't luanch it specifically through the continuum launcher?] I have an install of Python 2.7 on a windows machine. I just recently installed Anaconda, in addition. I just tried to install a new module for my Python install. I opened a command prompt in an unzipped folder for a python module and ran: python setup.py install However, I experienced an error at build line: building 'pyodbc' extension The

pyodbc and mySQL

佐手、 提交于 2019-11-30 20:54:43
I am unable to connect to mySQl db using pyodbc. Here is a snippet of my script: import pyodbc import csv cnxn = pyodbc.connect("DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost;DATABASE=mydb; UID=root; PASSWORD=thatwouldbetelling;") crsr = cnxn.cursor() with open('C:\\skunkworks\\archive\\data\\myfile.csv','r') as myfile: rows = csv.reader(myfile, delimiter=',', quotechar='"') for row in rows: insert_str = 'INSERT into raw_data VALUES(something, something)' print insert_str #crsr.execute(insert_str) cnxn.commit() myfile.close() I get this error at the pyodbc.connect() line: pyodbc.Error: (

pyodbc.connect timeout argument is ignored for calls to SQL Server

谁都会走 提交于 2019-11-30 19:37:39
I am using pyodbc on Linux with FreeTDS to connect to SQL Server 2005. I have noticed that the timeout argument to my connection is not being honoured by my queries. When I run the following I would expect to see timeout errors after both cursor.execute calls. import pyodbc import time connString = 'SERVER=dbserver;PORT=1433;DATABASE=db;UID=dbuser;PWD=dbpwd;' + \ 'DRIVER=FreeTDS' cnxn = pyodbc.connect(connString , timeout=3) cursor = cnxn.cursor() t1 = time.time() cursor.execute("SELECT MAX(Qty) FROM big_table WHERE ID<10000005") print cursor.fetchone() t2 = time.time() print t2-t1 cursor

Connecting to SQL server from SQLAlchemy using odbc_connect

荒凉一梦 提交于 2019-11-30 18:52:32
问题 I am new to Python and SQL server. I have been trying to insert a pandas df into our database for the past 2 days without any luck. Can anyone please help me debugging the errors. I have tried the following import pyodbc from sqlalchemy import create_engine engine = create_engine('mssql+pyodbc:///?odbc_connect=DRIVER={SQL Server};SERVER=bidept;DATABASE=BIDB;UID=sdcc\neils;PWD=neil!pass') engine.connect() df.to_sql(name='[BIDB].[dbo].[Test]',con=engine, if_exists='append') However at the

How to check version of python package if no __version__ variable is set

血红的双手。 提交于 2019-11-30 18:31:45
I am using pyodbc and I want to know the version of it that I am using. Apparently I cannot use pyodbc.__version__ because probably the variable is not set. How else can I figure out the version of the package? It does have the version info, just use .version : In [4]: pyodbc.version Out[4]: '3.0.10' The pip show command would also get it for you: In [54]: pip.main(["show","pyodbc"]) --- Metadata-Version: 1.1 Name: pyodbc Version: 3.0.10 Summary: DB API Module for ODBC Home-page: http://code.google.com/p/pyodbc Author: Michael Kleehammer Author-email: michael@kleehammer.com License: MIT

pyodbc remove unicode strings

こ雲淡風輕ζ 提交于 2019-11-30 18:22:05
问题 I'm using pyodbc to connect sqlserver and below is my connection string..Everything is proper but the results are returned as a unicode string..I have the CHARSET=UTF8 in the connection string but still its returning as unicode string? Is there any way that I can limit it using the connection paramter itself? I don't want to call a extra function to convert my unicode to normal strings. import pyodbc as p connstr= 'DRIVER={SQL Server};SERVER=USERNAME\SQLEXPRESS;DATABASE=TEST;Trusted

error: command 'cl.exe' failed: No such file or directory

余生颓废 提交于 2019-11-30 16:44:55
I am currently trying to install PYODBC via pip but am getting an error. at this point, I am at a loss on what to do. Here is what it looks like: C:\Users\c.ginther>pip install pyodbc Collecting pyodbc Using cached pyodbc-3.0.10.tar.gz Installing collected packages: pyodbc Running setup.py install for pyodbc ... error Complete output from command "c:\program files\python35\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\CB9EB~1.GIN\\AppData\\Local\\Temp\\pip-build-mdyxyolm\\pyodbc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n')

Using SQL Alchemy and pyodbc with IronPython 2.6.1

☆樱花仙子☆ 提交于 2019-11-30 16:40:17
I'm using IronPython and the clr module to retrieve SQL Server information via SMO. I'd like to retrieve/store this data in a SQL Server database using SQL Alchemy, but am having some trouble loading the pyodbc module. Here's the setup: IronPython 2.6.1 (installed at D:\Program Files\IronPython) CPython 2.6.5 (installed at D:\Python26) SQL Alchemy 0.6.1 (installed at D:\Python26\Lib\site-packages\sqlalchemy) pyodbc 2.1.7 (installed at D:\Python26\Lib\site-packages) I have these entries in the IronPython site.py to import CPython standard and third-party libraries: # Add CPython standard libs

error: command 'cl.exe' failed: No such file or directory

让人想犯罪 __ 提交于 2019-11-30 16:20:08
问题 I am currently trying to install PYODBC via pip but am getting an error. at this point, I am at a loss on what to do. Here is what it looks like: C:\Users\c.ginther>pip install pyodbc Collecting pyodbc Using cached pyodbc-3.0.10.tar.gz Installing collected packages: pyodbc Running setup.py install for pyodbc ... error Complete output from command "c:\program files\python35\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\CB9EB~1.GIN\\AppData\\Local\\Temp\\pip-build-mdyxyolm

make python wait for stored procedure to finish executing

我怕爱的太早我们不能终老 提交于 2019-11-30 13:59:33
问题 I have a python script that uses pyodbc to call an MSSQL stored procedure, like so: cursor.execute("exec MyProcedure @param1 = '" + myparam + "'") I call this stored procedure inside a loop, and I notice that sometimes, the procedure gets called again before it was finished executing the last time. I know this because if I add the line time.sleep(1) after the execute line, everything works fine. Is there a more elegant and less time-costly way to say, "sleep until the exec is finished"?