Greetings,
I am trying to get a basic sql statement working using arcpy.ArcSDESQLExecute, it keeps throwing an error.
I need to run an external sql with joins, etc in .sql file.
##The code
import arcpy,sys,csv
# Python environment
arcpy.env.overwriteOutput = True
workspace = arcpy.env.workspace = r"C:\database_connections\K2_Master_Training.sde"
sde_conn = arcpy.ArcSDESQLExecute(r"C:\database_connections\K2_Master_Training.sde")
sql = "SELECT * FROM tbSite"
sqlresult = sde_conn.execute(sql)
for i in sqlresult:
print i
Get the following error??
AttributeError: AttributeError(u'ArcSDESQLExecute: SreamBindOutputColumn ArcSDE Error -65 \uec5c',)
If would appreciate assistance getting this working, to read a sql file.
Thanks,
Clive
Hi Clive,
I'm not sure if you can execute wildcards with the ArcSDESQLExecute function. Try specifying a field name in your sql statement and it should work. Ex:
sql = "SELECT OBJECTID FROM tbSite"
Clive all the threads to the right in "more like this" seem to refer back to old threads of yours which were never resolved or you didn't respond to. Did any of those suggestions work? If not, perhaps you can follow up with a response to Jake's suggestion to facilitate narrowing down what you tried and what the result was.
from the help ArcSDESQLExecute—Help | ArcGIS for Desktop
there is no wildcard examples here or elsewhere