I cannot retrieve records for a Arc/Oracle database
I get an "UnicodeEncodeError: 'ascii' codec can't encode character" error
snippet of the code:
sdeConn = arcpy.ArcSDESQLExecute(sde_conn_file)
for tbl in tableList:
try:
userValue = "u'"
val = ''.join([x for x in userValue if ord(x) < 128])
sdeReturn = sdeConn.execute("SELECT * FROM DBA_OBJECTS" )
The records are printed out as:
[u'GISADMIN.KCC_KHS_CUSTOMER_LKP', u'GISADMIN.KCC_KHS_DISTRICT_LKP']
I tried to use a CSV.writer - did nothing??
def writerows(self, rows):
file = open(output_file, 'wb')
for row in rows:
print row
self.writerow(row)
file.close()
I would appreciate assistance to get the CSV.writer working...
Thanks,
Clive
I found a similar example @ arcpy.ArcSDESQLExecute(sde) problem
This has a working example of the CSV.Writer class.
Still getting an unicode error from the SQL statement:
sdeReturn = sdeConn.execute("SELECT * FROM DBA_OBJECTS" )
The script should return:
The code works on Database a
[u'USER, u'TABLE', u'Data1', u'Data2']
[u'USER, u'TABLE', u'Data1', u'Data2']
[u'USER, u'TABLE', u'Data1', u'Data2']
The u seems is needed for a new column, within the recordset.
The same script returns an error on Database b, an older database??
Which line of code is mentioned in the error message, and what's the full message? There should be a mention of the character in question there