How do I ensure that the oracle-target uses thin m...
# singer-targets
p
How do I ensure that the oracle-target uses thin mode, rather than cx_oracle? My problem is that I have table that contains CLOB data type, and that CLOB gets somehow interpreted as VARCHAR. I think that this is because I am using cx_oracle, which can be spotted in the following line of error stream after running "time meltano invoke target-oracle <out": cx_Oracle.DatabaseError: ORA-00910: specified length too long for its datatype of which the root cause can be seen a few lines later:
CREATE TABLE mytable (
description VARCHAR(<tel:4294967295|4294967295> CHAR),
But the field description should be CLOB, as can be seen in the out file (generated earlier by tap-oracle ingest) that I am using as input:
{"type":"SCHEMA","stream": [... omitting not relevant stuff...]
"PL_ID":{"multipleOf":1e-38,"type":["null","number"]},"PROJECT_NBR":{"multipleOf":1e-38,"type":["null","number"]},
I suppose the problem would disappear (hopefully) if I was using thin client rather than cx_Oracle both in tap and target. I achieved success in tap-oracle, it reports using thin. But how to force target-oracle to use thin client? I have already set these env variables, and ensured that oracledb is installed while cx_oracle is not installed:
$ env|grep thin
TARGET_ORACLE_DRIVER_NAME=oracle+thin
ORA_PYTHON_DRIVER_TYPE=thin
TAP_ORACLE_ORA_PYTHON_DRIVER_TYPE=thin
$ python -c "import oracledb; print(oracledb.version)"
2.5.1
$ python -c "import cx_Oracle; print(cx_Oracle.version)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cx_Oracle'
I also experimented with various contents of the variable TARGET_ORACLE_DRIVER_NAME, trying to set "thin" or "oracle+thin", for the documentation is unclear, with no effect - cx_oracle is still being used, I think. The documentation is here: https://hub.meltano.com/loaders/target-oracle Any hints?
e
The target seems to have harcoded the driver here: https://github.com/radbrt/target-oracle/blob/fdcb6e3e4327b39ba81974da708b08596d2c4a22/target_oracle/sinks.py#L38-L45 It's probably worth forking it to use your preferred driver, and if it works smoothly maybe send the author a PR making it actually configurable.
p
thank you, just to let you know I have followed your advice. Forked the target and I am doing various experiments.
👌 1