Question

Python module cx_oracle

  • 17 February 2015
  • 8 replies
  • 13 views

I have a python script which uses cx_oracle. It works fine on desktop but when I publish it to fme server, gives me an error. Reason being no cx_Oralce module on server.

 

 

I don't have access to fme server linux box. I came to know from fme documentation that you can upload module as a resource. Which file should I upload as a resource? Is it cx_Oracle.so or some other.

 

 

Cheers

 

John

8 replies

Userlevel 4
Hi,

 

 

unless you're already on FME Server 2015, I think you'll have to install the modules "the old fashioned way". If I'm not mistaken, modules as resources was introduced in FME 2015.0

 

 

More info here: http://fmepedia.safe.com/articles/How_To/Python-on-FME-Server

 

 

David
Same article says for FME 2014 & Previous "If you do not have access to the FME Server install directory on the server, you can upload the module to the server using the following procedure:?Publish the workspace to the server. Make sure you select the module file as a resource file to upload to the server when publishing"
Userlevel 4
I suspect installing cx_Oracle on Linux might be a bit more involved than just uploading a couple of files...

 

 

Some info here: http://stackoverflow.com/questions/4307479/install-cx-oracle-for-python

 

 

Unless somebody else can chime in here with specific details I recommend contacting Safe support.

 

 

But rather than using cx_Oracle, why not use fmeobjects.FMEUniversalReader/Writer?

 

 

David
I am trying to read list of tables from Oracle as suggested here (example 2)

 

 

http://fmepedia.safe.com/articles/How_To/Pass-a-List-of-Tables-or-Layers-to-an-FME-Reader-using-Python-Scripted-Parameters#heading_toc_j_5

 

 

Is there any better way?
Userlevel 4
Personally, I'd recommend example 3 on that page. That way you won't need cx_Oracle or any other customizations on the Server.

 

 

David
But I am not able to read Oracle table using Schema(Any format). Any idea how to read?
Userlevel 4
You need to add an Oracle reader as a workspace resource, where you specify the connection details: http://docs.safe.com/fme/html/FME_Workbench/FME_Workbench.htm#Workbench/reader_adding_as_resource.htm

 

 

You then tell the "Schema (any format)" reader to use this resource for the connection. Just tested on my machine and it works as advertised.

 

 

David
I am trying convert list of table in oracle spatial to any spatial format.

 

 

Say I have to convert 3 tables A,B,C. I have another table, LIST which has list of table I want to convert in this case A,B,C. Using the python script I was able to converts all tables mentioned in the table LIST.

 

 

But now I am not able to convert with the schema reader.

 

 

Could you please explain further.

 

 

Cheers.

 

 

 

Reply