Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle type 2016 "INTERVAL YEAR(2) TO MONTH" not supported #367

Open
adoutt opened this issue Nov 6, 2019 · 4 comments
Open

Oracle type 2016 "INTERVAL YEAR(2) TO MONTH" not supported #367

adoutt opened this issue Nov 6, 2019 · 4 comments

Comments

@adoutt
Copy link

adoutt commented Nov 6, 2019

I can do it properly with PL/SQL tool but ues cx_oracle following questions appear
cursor.execute('''select * from (select * from "ABC"."ALL_TYPE_TABLE5" order by dbms_random.random()) where rownum <= 1000''')
cx_Oracle.NotSupportedError: Oracle type 2016 not supported.

create table ALL_TYPE_TABLE5
(
col_1_bd BINARY_DOUBLE,
col_2_bf BINARY_FLOAT,
col_5_char CHAR(255),
col_6_date DATE,
col_7_idts INTERVAL DAY(2) TO SECOND(6),
col_8_iytm INTERVAL YEAR(2) TO MONTH,
col_11_number NUMBER,
col_12_nvarchar NVARCHAR2(255),
col_13_raw RAW(20),
col_14_timestamp TIMESTAMP(6),
col_15_twltz TIMESTAMP(6) WITH LOCAL TIME ZONE,
col_16_twtz TIMESTAMP(6) WITH TIME ZONE,
col_17_varchar VARCHAR2(255),
col_18_nchar NCHAR(20),
col_21_number_p2 NUMBER(5,2),
col_22_number_p4 NUMBER(8,4),
col_23_number_p8 NUMBER(16,8),
col_24_decimal INTEGER,
col_25_decimal_p2 NUMBER(4,2),
col_26_decimal_p4 NUMBER(7,4),
col_27_decimal_p8 NUMBER(10,8),
col_28_float_p4 FLOAT,
col_29_float_p8 FLOAT,
col_30_float_p16 FLOAT
)

@cjbj
Copy link
Member

cjbj commented Nov 6, 2019

Thanks for taking time to create the report. It is INTERVAL YEAR(2) TO MONTH that fails, as no doubt you know. I'll let @anthony-tuininga comment on the feasibility of support for this.

For reference, you can format code in github issues using https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks

@anthony-tuininga
Copy link
Member

Since Python does not natively support interval year to month data, cx_Oracle would have to implement an object itself. Do you have a need for it? If you do, can you explain what you would like to see included in this new type, other than the number of years and the number of months?

@adoutt
Copy link
Author

adoutt commented Nov 13, 2019

From my point of view, I am willing to accept this new type to ensure that my code will not fail to read this table due to this type of error

@cjbj
Copy link
Member

cjbj commented Nov 13, 2019

@adoutt can you write a PL/SQL function that accepts INTERVAL YEAR TO MONTH and returns some kind of string? Then use this in your query and convert that string in Python to whatever you want.

@cjbj cjbj changed the title Oracle type 2016 not supported Oracle type 2016 "INTERVAL YEAR(2) TO MONTH" not supported Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants