You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, the oracleCX package had an encoding connection setting in the connect method. Is it possible to somehow emulate this setting with OracleDB? As I understand it, data transferred to OracleDB is exclusively encoded in UTF-8, correct?
The second questions is far easier to answer. It wasn't introduced as it was always there! This is based on the Oracle Client libraries and their greater concern for covering every possible scenario that someone might want at some point. And my knowledge and understanding of character sets and string encodings was very poor at the time so I simply followed along. As my knowledge matured and the overall ecosystem matured, the need for this was no longer present and even in cx_Oracle the default was "utf-8" for many years already.
As for your first comment, you can easily enough bypass the decode when retrieving data from the database but the driver makes every effort to avoid sending strin…
@DFilyushin, the only advantage that the encoding attribute had was to define how character data was transferred between the client and the database -- and that was a very limited advantage and also the source of a great deal of confusion and unexpected behavior! The new driver only uses UTF-8 when communicating with the database (except during Direct Path Load and the packing/unpacking of database objects which use the database character set as required by the protocol itself). The default character set for Oracle Database has been AL32UTF8 (aka UTF-8) for many years now. Python and many other languages use UTF-8 internally for storing character data, so it makes sense to just use UTF-8 consistently and avoid conversions.
Why do you want to implement the encoding attribute in python-oracledb?
We're talking about supporting legacy code. On the Oracle side, the stored procedure expects 1251 encoding. This sounds strange, but they then convert this set of bytes to UTF-8. This is very old and strange code. We started rewriting part of it in Python and encountered this irrational behavior. But first, we need to maintain backward compatibility, otherwise we're breaking the existing code.
Second question: why was this behavior introduced at the OracleCX driver level?
The second questions is far easier to answer. It wasn't introduced as it was always there! This is based on the Oracle Client libraries and their greater concern for covering every possible scenario that someone might want at some point. And my knowledge and understanding of character sets and string encodings was very poor at the time so I simply followed along. As my knowledge matured and the overall ecosystem matured, the need for this was no longer present and even in cx_Oracle the default was "utf-8" for many years already.
As for your first comment, you can easily enough bypass the decode when retrieving data from the database but the driver makes every effort to avoid sending string data as anything other than UTF-8 encoded bytes, since that is what is dictated by the agreement between client and server. With the Oracle Client libraries and cx_Oracle you could set the client character set to the same value as the database character set and then proceed to send any data and none of it would be validated -- but that hole has been closed in the new driver and rightfully so! Even if the encoding was supported (and there are no plans to do so for the reasons I have already stated), it would always require sending and receiving in that encoding -- and what you are describing seems to be a violation of that anyway.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
The second questions is far easier to answer. It wasn't introduced as it was always there! This is based on the Oracle Client libraries and their greater concern for covering every possible scenario that someone might want at some point. And my knowledge and understanding of character sets and string encodings was very poor at the time so I simply followed along. As my knowledge matured and the overall ecosystem matured, the need for this was no longer present and even in cx_Oracle the default was "utf-8" for many years already.
As for your first comment, you can easily enough bypass the decode when retrieving data from the database but the driver makes every effort to avoid sending strin…