I am writing a code to Oracle to Impala data mirroring with python.
I am using cx_Oracle for Oracle connection and impyla for Impala connections.I have created Impala tables' fields with similar type of Oracle tables' fields
I am reading varchar2 type variable from Oracle without any error but could not insert it into Impala as string. So I try to insert like following statement
sql = "insert into test01.testdcr values (%f, cast('%s' as VARCHAR(128)), %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, '%s')" % \
(row, row, row, row, row, row, row, row, row, row, row, row, row)
There was no error in above code so I could successfully insert my data
But there is a note in Impala documentation about string data type
You can use CAST() to convert STRING values to TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, or TIMESTAMP.
So there is no VARCHAR type conversion from STRING.
My question is can I trust my code ?
If not what is the proper way of this conversion ?
The list of conversions isn't exhaustive. The Varchar docs for Impala 2.0.x have examples for the conversion you're looking for: