ArcSDESQLExecture error -202 illegal character

2123
0
04-03-2019 03:35 PM
AndyCho
New Contributor

I'm trying to retrieve data from a remotely stored sde using sql given the suggestion that it may be faster than using copy features and other arcpy functions (3 gb feature class was taking 4+ hours to transfer over to a feature class in an empty fileGDB). I have tried the following code: 

import arcpy


db = r"Q:\SDE\Direct Connection to remote.sde"
egdb_conn = arcpy.ArcSDESQLExecute(db)

table_name = 'Topography\Contour'

sql = '''
SELECT load_date FROM {0}
'''.format(table_name)

egdb_return = egdb_conn.execute(sql)
for i in egdb_return:

print('{}: {}'.format(*i))

When I run the code, I come across the following error

AttributeError: ArcSDESQLExecute: StreamPrepareSQL ArcSDE Extended error -202 [Informix][Informix ODBC Driver][Informix]An illegal character has been found in the statement.

The sql statement is shown as '\nSELECT load_date FROM delivery:eicu.Topography\\delivery:eicu.Contour_Other\n'

What would be the issue? 

Tags (1)
0 Kudos
0 Replies