Hi Team,
I’m running the python script to import new data to omnisci using pymapd. I’m experiencing below mentioned exception from “execute” method.
Exception
Unexpected character: b’<’
Traceback (most recent call last):
File “Omnisci-Import.py”, line 137, in mapd_execute
resCur = mapdcon.execute(sql,parameters=values)
File “/home/ubuntu/.local/lib/python3.7/site-packages/pymapd/connection.py”, line 291, in execute
return c.execute(operation, parameters=parameters)
File “/home/ubuntu/.local/lib/python3.7/site-packages/pymapd/cursor.py”, line 117, in execute
nonce=None, first_n=-1, at_most_n=-1)
File “/home/ubuntu/.local/lib/python3.7/site-packages/omnisci/mapd/MapD.py”, line 1598, in sql_execute
return self.recv_sql_execute()
File “/home/ubuntu/.local/lib/python3.7/site-packages/omnisci/mapd/MapD.py”, line 1615, in recv_sql_execute
(fname, mtype, rseqid) = iprot.readMessageBegin()
File “/home/ubuntu/.local/lib/python3.7/site-packages/thrift/protocol/TJSONProtocol.py”, line 417, in readMessageBegin
self.readJSONArrayStart()
File “/home/ubuntu/.local/lib/python3.7/site-packages/thrift/protocol/TJSONProtocol.py”, line 405, in readJSONArrayStart
self.readJSONSyntaxChar(LBRACKET)
File “/home/ubuntu/.local/lib/python3.7/site-packages/thrift/protocol/TJSONProtocol.py”, line 256, in readJSONSyntaxChar
“Unexpected character: %s” % current)
thrift.protocol.TProtocol.TProtocolException: Unexpected character: b’<’During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “Omnisci-Import.py”, line 619, in main
process_new_data_to_omnisci(conn,cur,mapdcon,mapdTbl,pgTbl)
File “Omnisci-Import.py”, line 208, in process_new_data_to_omnisci
create_or_update_rental_units(pgTbl, mapdTbl, df, mapdcon)
File “Omnisci-Import.py”, line 439, in create_or_update_rental_units
resCur = mapd_execute(“SELECT count(*) FROM {0} where id = :id”.format(mapdTbl,id),{“id” : int(id)})
File “Omnisci-Import.py”, line 153, in mapd_execute
raise Exception(ex)
Exception: Unexpected character: b’<’
Inputs
Sql query string : “SELECT count(*) FROM {TABLE} where id = :id”
Parameters : {“id” : 12345}
After getting this error, the subsequent call also throws the same error while re-connecting into the omnisci.
Only after sometime, If I run the same script again then I’m able to process for another 500 to 1000 records, then again it throws the same error.
I’m trying to push new updates(atleast 5000 records) daily to omnisci. Its like find and create/update the record(query to find if record is exist then sql script to create/update the record).
Currently, I’m not able to process even 2000 records successfully.
Could you please give some suggestion? Thanks!