pyodbc

What download file do I need to get PyODBC 3.1.1 for Python 3.2?

让人想犯罪 __ 提交于 2019-12-11 05:51:51
问题 I can't make head nor tail out of the wheelhouse install files for PyODBC. There seem to be three parameters encoded in .whl file names at https://pypi.python.org/pypi/pyodbc/3.1.1 . One appears to be a Python version number, and no file is listed for Python 3.2. Another parameter is the processor, and I haven't the foggiest idea what the third parameter is. This is the first time I've ever heard of a "wheelhouse" installation file. Thank you for any help you can provide. 回答1: Why are you

pydev project - no module named pyodbc

 ̄綄美尐妖づ 提交于 2019-12-11 04:26:49
问题 Hello guys I am pretty new to all this so please bear with me. I am trying to execute the following python code on eclipse but finding some errors: import pyodbc from bs4 import BeautifulSoup I get the following error for both: import pyodbc ModuleNotFoundError: No module named 'pyodbc' import BeautifulSoup ModuleNotFoundError: No module named 'BeautifulSoup' When going to command prompt and clicking on pip install pyodbc I get the following: Requirement already satisfied: pyodbc in c:\users

Error in opening an Access database in python

时光怂恿深爱的人放手 提交于 2019-12-11 04:17:00
问题 I am a new to python programming and i want to write a python program to read and write data to and from the database. The connection code is as follows: DNS='catalog' DRV = '{Microsoft Access Driver (*.mdb)}' conn = pyodbc.connect('DRIVER=%s;DSN=%s;' % (DRV,DNS)) catalog is the DSN name. I am am getting the following error: Traceback (most recent call last): File "C:\Python27\exampes\xxx.py", line 8, in <module> conn = pyodbc.connect('DRIVER=%s;DSN=%s;' % (DRV,DNS)) Error: ('01000', "[01000]

Pyodbc execution failed on temp table

倖福魔咒の 提交于 2019-12-11 03:56:26
问题 I have a Python Script which uses the pyodbc library to run some queries which I have task scheduler running on a set schedule. The script had been working fine without issue all of last week and it suddenly encountered the error: DatabaseError: Execution failed on sql 'select * from #output ('42S02', "[42S02] [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name '#output'. (208) (SQLExecDirectW)") This error arises when I try to extract that data from the query using pd

pyodbc doesn't report sql server error

邮差的信 提交于 2019-12-11 03:32:38
问题 I have an issue where pyodbc doesn't capture errors returned from stored procedure. My actual stored proc does a lot of stuff but for the purpose of demonstrating the error I created a simple proc and associated python code. Relevant code is below: Stored Procedure: CREATE PROCEDURE [dbo].[testErrors] -- Add the parameters for the stored procedure here AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements

Geting Data from MSSQL Using pyodbc Error

扶醉桌前 提交于 2019-12-11 02:31:57
问题 I am using pyodbc to retrieve data from MSSQL and this is the code I am using: import pyodbc server = 'xxxxxxxx\DEV' database = 'SandBox' username = 'zzzzzzz' password = 'xxxxxxx' driver = '{SQL Server}' cnxn = pyodbc.connect('DRIVER='+driver+';PORT=4853;SERVER='+server+';PORT=4853;DATABASE='+database+';UID='+username+';PWD='+ password) cursor = cnxn.cursor() cursor.execute("select * from fieldscreenscheme ") row = cursor.fetchone() if row: print row This is the error massage I got: cnxn =

pyodbc rowcount only returns -1

风格不统一 提交于 2019-12-11 01:43:56
问题 How does rowcount work. I am using pyodbc and it's always returning -1. return_query = conn.query_db_param(query, q_params) print(return_query.rowcount) def query_db_param(self, query, params): self.cursor.execute(query,params) print(self.cursor.rowcount) 回答1: rowcount refers to the number of rows affected by the last operation. So, if you do an insert and insert only one row, then it will return 1. If you update 200 rows, then it will return 200. On the other hand, if you SELECT , the last

Passing a parameter to a sql query using pyodbc failing

懵懂的女人 提交于 2019-12-11 01:09:47
问题 I have read dozens of similar posts and tried everything but I still get an error message when trying to pass a parameter to a simple query using pyodbc. Apologies if there is an answer to this elsewhere but I cannot find it I have a very simple table: select * from Test yields a b c This works fine: import pyodbc import pandas connection = pyodbc.connect('DSN=HyperCube SYSTEST',autocommit=True) result = pandas.read_sql("""select * from Test where value = 'a'""",connection,params=None) print

Multi-row UPSERT (INSERT or UPDATE) from Python

自闭症网瘾萝莉.ら 提交于 2019-12-11 00:56:26
问题 I am currently executing the simply query below with python using pyodbc to insert data in SQL server table: import pyodbc table_name = 'my_table' insert_values = [(1,2,3),(2,2,4),(3,4,5)] cnxn = pyodbc.connect(...) cursor = cnxn.cursor() cursor.execute( ' '.join([ 'insert into', table_name, 'values', ','.join( [str(i) for i in insert_values] ) ]) ) cursor.commit() This should work as long as there are no duplicate keys (let's assume the first column contains the key). However for data with

Speed up inserts into SQL Server from pyodbc

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 00:31:52
问题 In python , I have a process to select data from one database ( Redshift via psycopg2 ), then insert that data into SQL Server (via pyodbc ). I chose to do a read / write rather than a read / flat file / load because the row count is around 100,000 per day. Seemed easier to simply connect and insert. However - the insert process is slow, taking several minutes. Is there a better way to insert data into SQL Server with Pyodbc? select_cursor.execute(output_query) done = False rowcount = 0 while