RE: [cx-oracle-users] set{input,output}sizes() (changed subject)
Brought to you by:
atuining
From: Guido v. R. <gu...@el...> - 2005-05-17 19:58:20
|
> Null in database speak still has a type. In other words, there is a > difference between a null number and a null string and a null date. > Python does not have such a distinction so cx_Oracle simply assumes > string. In many cases this won't be a problem even if the underlying > data type is number since Oracle implicitly converts data types but in > other cases it really matters so you need to specify. Can you give an example of where it matters? (We've got a lot of cx_Oracle code in-house here and it has never been an issue AFAIK.) > Interfaces are always interesting since the viewpoints are often > considerably different. Most times the interface is seamless but there > are a few instances where the database viewpoint pokes out. :-) Any > suggestions on how to improve this are welcome, of course! So true. > > example, when inserting a 100K-long string into a table column whose > > type is CLOB, why would I have to say that it's a CLOB again? >=20 > Any string longer than 4000 characters cannot be represented as > varchar2 but there are several options: long, long raw, CLOB, BLOB so > which one gets chosen? At the moment cx_Oracle does not guess at all > and simply allows the error to be propagated. Again, suggestions are > welcome! It would depend on what happens if you guessed wrong. For example, if the conversion to CLOB were lossless and Oracle would automatically convert a CLOB to the required type, you could guess CLOB and the worst that could happen is that things slow down. But if the conversion is lossy or Oracle bites you instead of converting, the status quo seems as good as it gets. I guess one of the problems is that you have to pick one of the Oracle types without knowing the type that's actually required. BTW, this reminds me. What would be the disadvantage of defaulting arraysize to something large (e.g. 1000, which we've found to work well for our code) other than some wasted memory? How can I calculate the memory needed when I set arraysize to a certain value? --Guido van Rossum (home page: http://www.python.org/~guido) |