My favorites
▼
|
Sign in
pyodbc
Python ODBC library
Project Home
Downloads
Wiki
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
41
attachment: PythonCode.txt
(707 bytes)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def connect(query):
"""Sets up a DB connection and runs a query. Returns the recordset"""
connection = pyodbc.connect('[The Connection String Works]', autocommit=True)
print "Query as it goes in to be executed:"
print query
cursor = connection.execute(query)
connection.commit()
return cursor
def getQueryResults(query):
"""Pulls down the results of a query and returns the whole thing as an array of tuples."""
cursor = connect(query)
print cursor
row = cursor.fetchone()
finalArray = []
while row:
finalArray.append(row)
row = cursor.fetchone()
cursor.close()
del cursor
return finalArray
Powered by
Google Project Hosting