-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_pydbc.py
More file actions
33 lines (27 loc) · 915 Bytes
/
config_pydbc.py
File metadata and controls
33 lines (27 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# ---------------------------------------------------------------------------
# PollMap Config SCRIPT v0.1
# Alex Yule 9/15/11
# Created on: 2011-09-15
# Description: Builds and returns a PollMap config object
# ---------------------------------------------------------------------------
import arcpy
import pyodbc
from string import join
def status(msg): #logging function
print msg
arcpy.AddMessage(msg)
arcpy.SetProgressorLabel(msg)
#db = r"D:\Data\SDE_CONNECTIONS\niflheim_express1_collegefootball_webeditor.sde"
dsn = "sqlexpress1"
db = "collegefootball"
connectStr = 'DSN='+dsn+';DATABASE='+db
configTableSelect = 'COUNT LOCATION FROM '+db+'.DBO.votes'
status(connectStr)
status(configTableSelect)
connect = pyodbc.connect(connectStr)
status(connect)
cursor = connect.cursor()
cursor.execute(configTableSelect)
print cursor.fetchall()
del cursor
del connect