Fully managed cloud. 30-day FREE full featured trial. Start Now
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the oracle odbc driver in python udf's with pyodbc

drahman
Contributor

Hi,

this article (https://community.exasol.com/t5/tech-blog/how-to-export-import-between-exasol-s-database-and-oracle-...) describes how to add the oracle odbc driver, so that you can create native import/export statements.

However, what if I want to use a python3-udf with pyodbc to connect to a remote oracle Database? It doesn't seem, that I can use an existing oracle-connection.

How can I add an oracle odbc driver correctly for use in Python-UDF's? Is this even possible?

 

Thanks for any suggestion in advance!

2 REPLIES 2

mwellbro
Xpert

Hi @drahman ,
since you can´t just "drop a .jar file" like with JDBC I´d think that the easy way of putting it in BucketFS and using it from there will probably not work ( anyone, please correct me if I´m wrong on this ).

First thing that came to mind would be a custom PYHTON language container, an extension on what is shipped so to speak, which contains the Ora-ODBC-driver installed so you´d be able to use it - haven´t done that myself, but there are a few knowledgeable
people around regarding that topic I believe - so yes, it should be possible.
I don´t have the links on hand, might be able to add them later.

Cheers,
Malte 

wunderdata
SQL-Fighter

So additionally to adding the pyodbc packet which is fairly simple:

https://docs.exasol.com/database_concepts/udf_scripts/adding_new_packages_script_languages.htm

https://github.com/exasol/script-languages-release

I think in this case you would also need to install unixodbc (I think it even needs unixodbc-dev...) in the docker container then.
Using the existing oracle connection in an udf should work though:
https://community.exasol.com/t5/data-science/connections-and-udfs/ta-p/3057
https://docs.exasol.com/database_concepts/udf_scripts/python3.htm#AccessingConnectionDefinitions
Or am I missing something?