I'm using Oracle Database with UTF-16 encoding. The diacritics is correctly displayed when using directly cx_oracle client. Connection statement is like this:
cx_Oracle.connect(username, password, conn_str, encoding='UTF-16', nencoding='UTF-16')
However, now I'm building bigger application and I would like to use SQLalchemy in Flask.
Code looks like this:
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
db.Model.metadata.reflect(db.engine)
class MyTable(db.Model):
__table__ = db.Model.metadata.tables['mytable']
for row in MyTable.query:
print(row.column_with_diacritics)
Output of the code above: aoe
But the column value in the database is: áóé
So my question is, how can pass arguments encoding='UTF-16', nencoding='UTF-16' to cx_oracle which sqlalchemy uses underhood?
Thank you for any advice or other workaround.