pythonsqlnetezzanzsql

Error retreiving database 'NZPYIDA' with NZFunApply function


I'm trying to run this code via jupyter notebook to apply a function on the table in netezza server, so I can apply this code on the table inside without getting data out of table/database.

from nzpyida import IdaDataBase, IdaDataFrame
from nzpyida.ae import  NZFunApply

idadb = IdaDataBase('weather', 'admin', 'password', verbose=True)

idadf = IdaDataFrame(idadb, 'WEATHER')

code_str_apply = """def apply_fun(self, x):
    from math import sqrt
    max_temp = x[3]
    id = x[24]
    fahren_max_temp = (max_temp*1.8)+32
    row = [id, max_temp,  fahren_max_temp]
    self.output(row)
    """
output_signature = {'ID': 'int', 'MAX_TEMP': 'float', 'FAHREN_MAX_TEMP': 'float'}
nz_apply = NZFunApply(df=idadf, code_str=code_str_apply, fun_name='apply_fun', output_table="temp_conversion",output_signature=output_signature, merge_output_with_df=True)
result = nz_apply.get_result()
print(result)

This code returns the following error message,

ProgrammingError: ERROR: ResolveCatalog: error retrieving database 'NZPYIDA'

I'm not using database named 'NZPYIDA' anywhere in the notebook, I am not sure what's causing this error and what is going on! The server has INZA installed.

Please suggest! Thanks in Advance :)


Solution

  • This is know issue when nzpyida code push-down is used with some versions of INZA. The code of NZFunApply wants to use some db stored procedures from NZPYIDA database, but INZA installation does not create such database at all (not to mention the required stored procedures).

    To fix this issue, you have to install INZA 11.2.28.