Have a view in SQL that I want to bring into ArcGIS using python. It is part of a process of a longer python script. how can I do this using python.
In 9.3 I used my ODBC connection "AR" to do this and then brought in my file "GISWEB.VW_MCYWEB" as an XY Event and then exported it as a shapefile with a coordinate system of WebMercator so that I could use it in my web maps.
I've tried several things but nothing is working for me at the moment. I'm sure this is simple but I'm not see how to do this.
I thought maybe this would work.
import arcpy
import win32api, win32con
import sys
import pyodbc
from arcpy import env
def defAddSQLTable_CreateShapefile():
### Works Makes a list of all tables in SQL Database for that DSN Connection ###
cnxn = pyodbc.connect("DSN=AR")
arcpy.env.workspace= 'C:/temp'
in_Table = "AR.GISWEB.VW_MCYWEB"
y_coords = "Longitude"
x_coords = "Latitude"
out_layer = "Stores"
arcpy.env.overwriteOutput = 'true'
arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_layer)
defAddSQLTable_CreateShapefile()