Public member function documentation

__init__(self)
The object constructor.
Calls the _AeInternal constructor; also tracks the number of instances of AEs that have been created.
didClassRun(Class)
Determines if the class was run.
Returns
(boolean)
TRUE if the class was run; FALSE otherwise.
getRequestHandlingStyle(Class)
Gets the request handling style.
Returns
(REQUEST_HANDLING_STYLE)
The request handling style.

This function returns either REQUEST_HANDLING_STYLE__USE_THREADS, REQUEST_HAND- LING_STYLE__FORK, or REQUEST_HANDLING_STYLE__SINGLE_THREADED based on the cur- rent request handling style.

run(Class)
Runs the AE Class.

For local AEs, when a request is made, this function calls _runLocal on the AE Class. For remote AEs, when a request is made, it calls _runRemote on the AE class.

close(self)
Optional.

Called when no more calls are to be made to the Netezza software.

done(self)
Optional.

Called when no more output is to be written to the Netezza software.

isLocal(Class)
Determines if this is a local AE.
Returns
(boolean)
Returns TRUE if this is a local AE; FALSE otherwise.
isRemote(Class)
Determines if this is a remote AE.
Returns
(boolean)
Returns TRUE if this is a remote AE; FALSE otherwise.
isAggregateAe(self)
Determines if this is an aggregate AE.
Returns
(boolean)
Returns TRUE if this is an aggregate AE; FALSE otherwise.

This returns the same value as isUda .

isFunctionAe(self)
Determines if this is a function AE.
Returns
(boolean)
Returns TRUE if this is a function AE; FALSE otherwise.
isShaperAe(self)
Determines if this is a shaper/sizer AE.
Returns
(boolean)
Returns TRUE if this is a shaper/sizer AE; FALSE otherwise.
isUda(self)
Determines if this is an aggregate AE.
Returns
(boolean)
Returns TRUE if this is an aggregate AE; FALSE otherwise.
isUdf(self)
Determines if this is a UDF-based AE.
Returns
(boolean)
Returns TRUE if this is a UDF-based AE; FALSE otherwise.
isUdfSizer(self)
Determines if this is a UDF sizer.
Returns
(boolean)
Returns TRUE if this is a UDF sizer AE; FALSE otherwise.
isUdtf(self)
Determines if this is a UDTF-based AE.
Returns
(boolean)
Returns TRUE if this is a UDTF-based AE; FALSE otherwise.
isUdtfShaper(self)
Determines if this is a UDTF shaper.
Returns
(boolean)
Returns TRUE if this is a UDTF shaper AE; FALSE otherwise.
pingNps(self)
Call to notify the Netezza software that work is still being performed and the AE should not be terminated.

When there are long periods of inactivity with the AE system, this function should be called to notify the Netezza software that the AE is still working.

getConnectionPointName(Class)
Returns the connection point name for this AE.
Returns
(string)
The connection point name.
getConnectionPointDatasliceId(Class)
Returns the connection point dataslice ID for this AE.
Returns
(integer)
The dataslice ID.

The value returned is -1 if the AE is not running in remote mode by dataslice.

getConnectionPointSessionId(Class)
Returns the connection point session ID for this AE.
Returns
(integer)
The session ID.

The value returned is -1 if the AE is not running in remote mode by dataslice.

getConnectionPointTransactionId(Class)
Returns the connection point transaction ID for this AE.
Returns
(integer)
The transaction ID.

The value returned is -1 if the AE is not running in remote mode by dataslice.

setConnectionPointName(Class, connectionPointName)
Sets the connection point name for this AE.
Parameters
connectionPointName
(string) The name of the connection point.

If using the built-in remote AE launching mechanism, the connection point info is automatically set from the process environment, and this function does not need to be called. An alternative to using this func- tion, the deriving class may override the class variable, CONNECTION_POINT_NAME.

setConnectionPointDatasliceId(Class, datasliceId)
Sets the connection point dataslice ID for this AE.
Parameters
datasliceId
(integer) The connection point dataslice ID.

If using the built-in remote AE launching mechanism, the connection point info is automatically set from the process environment, and this function does not need to be called.

setConnectionPointSessionId(Class, sessionId)
Sets the connection point session ID for this AE.
Parameters
sessionId
(integer) The connection point session ID.

If using the built-in remote AE launching mechanism, the connection point info is automatically set from the process environment, and this function does not need to be called.

setConnectionPointTransactionId(Class, transactionId)
Sets the connection point transaction ID for this AE.
Parameters
transactionId
(integer) The connection point transaction ID.

If using the built-in remote AE launching mechanism, the connection point info automatically set from the process environment, and this function does not need to be called.

describe(self)
Returns a string representation of the metadata.
Returns
(string)
A string representation of the metadata.
getDataTypeName(self, dataType)
Gets the name of a specified data type.
Parameters
dataType
(DATA_TYPE) The data type.
Returns
(string)
The name of the specified data type.
getInputTypes(self)
Gets a list of input data types.
Returns
(list<DATA_TYPE>)
The list of input data types.
getNumberOfInputColumns(self)
Gets the number of input columns.
Returns
(integer)

The number of input columns.

This function is valid for function and shaper AEs and when aggregate AEs are in the 'accumu- late' processing state.

getNumberOfOutputColumns(self)
Gets the number of output columns.
Returns
(integer)
The number of output columns.

This function is valid for function AEs and when aggregate AEs are in the 'finalize' processing state.

getInputPrecision(self, columnIndex)
Gets the precision of an input numeric.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The precision of the input string at the specified column index.

This function is valid for function and shaper AEs and when aggregate AEs are in the 'accumu- late' processing state.

getInputScale(self, columnIndex)
Gets the scale of an input numeric.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The scale of the input string at the specified column index.

This function is valid for function and shaper AEs and when aggregate AEs are in the 'accumulate' processing state.

getInputSize(self, columnIndex)
Gets the size of an input string.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The size of the input string at the specified column index.

This function is valid for function and shaper AEs and when aggregate AEs are in the 'accumulate' processing state.

getInputType(self, columnIndex)
Gets the data type of an input.
Parameters
columnIndex
(integer) The index of the column.
Returns
(DATA_TYPE)
The data type of the input at the specified column index.

This function is valid for function and shaper AEs and when aggregate AEs are in the 'accumulate' processing state.

getOutputPrecision(self, columnIndex)
Gets the precision of an output numeric.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The precision of the output string at the specified column index.

This function is valid for function AEs and when aggregate AEs are in the 'finalize' processing state.

getOutputScale(self, columnIndex)
Gets the scale of an output numeric.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The scale of the output string at the specified column index.

This function is valid for function AEs and when aggregate AEs are in the 'finalize' processing state.

getOutputSize(self, columnIndex)
Gets the size of an output string.
Parameters
columnIndex
(integer) The index of the column.
Returns
(integer)
The size of the output string at the specified column index.
This function is valid for function AEs and when aggregate AEs are in the 'finalize' processing state.
getOutputType(self, columnIndex)
Gets the data type of an output.
Parameters
columnIndex
(integer) The index of the column.
Returns
(DATA_TYPE)
The data type of the output at the specified column index.

This function is valid for function AEs and when aggregate AEs are in the 'finalize' processing state.

getUdfReturnType(self)
Gets the return data type for a UDF.
Returns
(DATA_TYPE)
The data type of the output field.

This function is only valid for UDF sizer AEs.

isCalledWithOrderByClause(self)
Determines if the function was called with an ORDER BY clause.
Returns
(boolean)
TRUE if the function was called with an ORDER BY clause; FALSE otherwise.

This function is only valid for function AEs.

isCalledWithOverClause(self)
Determines if the function was called with an OVER clause.
Returns
(boolean)
TRUE if the function was called with an OVER clause; FALSE otherwise.

This function is only valid for function AEs.

isCalledWithPartitionByClause(self)
Determines if the function was called with a PARTITION BY clause.
Returns
(boolean)
TRUE if the function was called with a PARTITION BY clause; FALSE otherwise.

This function is only valid for function AEs.

isDataInnerCorrelated(self)
Determines if the function data is inner-correlated.
Returns
(boolean)
TRUE if the function data is inner-correlated; FALSE otherwise.

This function is only valid for function AEs.

isDataLeftCorrelated(self)
Determines if the function data is left-correlated.
Returns
(boolean)
TRUE if the function data is left-correlated; FALSE otherwise.

This function is only valid for function AEs.

isDataUncorrelated(self)
Determines if the function data is uncorrelated.
Returns
(boolean)
TRUE if the function data is uncorrelated; FALSE otherwise.

This function is only valid for function AEs.

getCurrentUsername(self)
Gets the database username of the current AE being run.
Returns
(string)
The database username.
getDatasliceId(self)
Determines the ID of the dataslice being serviced by the AE.
Returns
(integer)
The dataslice ID that is being serviced by the AE.
getHardwareId(self)
Determines the ID of the hardware on which the AE is running.
Returns
(integer)
The hardware ID on which the AE is running.
getLogMask(self)
Gets the log mask that the AE is running on.
Returns
(LOG_MASK)
The log mask on which the AE is running.
getNumberOfDataSlices(self)
Gets the number of dataslices that are running on the Netezza appliance.
Returns
(integer)
The number of dataslices that are running on the Netezza appliance.
getNumberOfSpus(self)
Gets the number of SPUs running on the Netezza appliance.
Returns
(integer)
The number of SPUs running on the Netezza appliance.
getSuggestedMemoryLimit(self)
Gets the suggested memory limit for this AE.
Returns
(integer)
The suggested memory limit for this AE.
getSessionId(self)
Gets the session ID associated with this AE.
Returns
(integer)
The session ID associated with this AE.
getTransactionId(self)
Gets the transaction ID associated with this AE.
Returns
(integer)
The transaction ID associated with this AE.
isAUserQuery(self)
Determines if the AE is handling a user query.
Returns
(boolean)
TRUE if the AE is handling a user query; FALSE otherwise.
isLoggingEnabled(self)
Determines if logging is enabled.
Returns
(boolean)
TRUE if logging is enabled; FALSE otherwise.
isRunningInPostgres(self)
Determines if this AE is running in Postgres.
Returns
(boolean)
TRUE if this AE is running in Postgres; FALSE otherwise.
isRunningInDbos(self)
Determines if this AE is running in DBOS.
Returns
(boolean)
TRUE if this AE is running in DBOS; FALSE otherwise.
isRunningOnSpu(self)
Determines if this AE is running on the SPU.
Returns
(boolean)
TRUE if this AE is running on the SPU; FALSE otherwise.
isRunningOnHost(self)
Determines if this AE is running on the host.
Returns
(boolean)
TRUE if this AE is running on the host; FALSE otherwise.
getSharedLibraryPath(self, libraryName, caseSensitive=True)
Gets the path to a shared library.
Parameters
libraryName
(string) The name of the shared library.
[caseSensitive=True]
(boolean) Specifies whether to search in a case-sensitive manner.
Returns
(string)
The full path to the shared library.

Throws an AeSharedLibraryNotFoundException if the shared library is not found.

yieldSharedLibraries(self, forProcess=False)
Returns a generator that yields a shared library name and the corresponding full path for each shared library entry.
Parameters
[forProcess=False]
(boolean) If set this yields shared library names and full paths for the remote AE process.
Returns
(generator -> tuple<string, string>)
Each iteration over the generator yields a library name and the full path to that library.
Note: This function is generally called by using a FOR clause to retrieve the non-process shared library entries, for example: "FOR name, path IN self.yieldSharedLibraries(): ...".
getEnvironment(self)
Returns a dict containing the entire environment.
Returns
(dict<string, string>)
The environment.
getEnvironmentVariable(self, variableName, defaultValue)
Gets the value of an entry in the environment.
Parameters
variableName
(string) The name of the environment variable to fetch.
[defaultValue]
(object) The result to be returned if the entry is not found.

Returns the environment value for <variableName>. If no default value is specified, and the variable is not in the environment, an exception is thrown.

userError(self, errorString)
Ends the query and sends the user an error message.
Parameters
errorString
(string) The error message to send to the user.
getLogFilePath(self)
Gets the log file path.
Returns
(string)
The log file path.
log(self, text, logLevel=None)
Log a message to the AE log file and optionally to stderr and/or the Python AE log.
Parameters
text
(string) The message to log.
logLevel
(LOG_LEVEL) The level at which to log; None defaults to LOG_LEVEL__TRACE.

If the registered LOG_LEVEL is set above 0, the message also logs to stderr. If the registered LOG_LEVEL is set above 4, the message also logs to the log file found at /nz/export/ae/pythonDebugLogs.

__iter__(self)
Yield rows of data.
Only valid for function AEs. This is an overloaded standard iterator that yield rows of input data. The Py- thon value None is returned in the list if a NULL database value is encountered.
getInputRow(self)
Returns a list containing the elements of the current input row.
Returns
(list<object>)
The input row.

The Python value None is returned in the list if a NULL database value is encountered.

getInputValue(self, columnIndex)
Returns the value of the current input at a specified column index.
Parameters
columnIndex
(integer) The column index of the value to fetch.
Returns
(object)
The value of the current input at the specified column index.

The Python value None is returned if a NULL database value is encountered.

getInputString(self, columnIndex)
Returns the String value of the current input at a specified column index.
Parameters
columnIndex
(integer) The column index of the value to fetch.
Returns
(object)
The String value of the current input at the specified column index.

The Python value None is returned if a NULL database value is encountered.

getNext(self)
Loads the next input row into memory.
outputCurrentRow(self)
Outputs the current row.
outputInputColumn(self, inputColumnIndex, outputColumnIndex)
Copies an input field into an output field.
Parameters
inputColumnIndex
(integer) The column index of the input row to copy.
outputColumnIndex
(integer) The column index of the output to write to.
getState(self, columnIndex=None)
Gets a list containing the current state.
Parameters
[columnIndex]
(integer) The column index of state to retrieve. If not provided, the function returns a list containing the whole row of state.
Returns
(list<object> or object)
If no index is specified, a list of the current state. Otherwise, the state at the specified column index.

Throws an exception if called when the aggregate state is not available. The Python value None is returned where the state is NULL in the database.

getInputState(self, columnIndex=None)
Gets a list containing the input state, that is, the state to merge.
Parameters
[columnIndex]
(integer) The column index of state to retrieve. If not specified the function returns a list containing the whole row of state.
Returns
(list<object>)
A list of the state to merge.

Throws an exception if not called during the "merge" or "finalize" process state of an aggreg- ate.

Throws an exception if called when aggregate input state is not available. The Python value None is returned where the state is NULL in the database.

setState(self, indexOrState, state)
Sets the current state.
Parameters
indexOrState
(any) If two arguments are specified, the column index of the state to set. Otherwise, a list used to set the entire state.
[state]
(object) The state to set if setting a single column of the state with the function.

The Python value None should be used if the state is to be set to NULL in the database.

getNumberOfStateColumns(self)
Gets the number of columns in the state.
Returns
[integer]
The number of columns in the state.
getStateDataType(self, columnIndex)
Gets the data type of a field of state at the specified column index.
Parameters
columnIndex
(string) The index of the column of state.
Returns
[integer]
The data type of the column.
getStatePrecision(self, columnIndex)
Gets the precision of a field of state at the specified column index.
Parameters
columnIndex
(string) The index of the column of state.
Returns
[integer]
The precision of the column.
getStateScale(self, columnIndex)
Gets the scale of a field of state at the specified column index.
Parameters
columnIndex
(string) The index of the column of state.
Returns
[integer]
The scale of the column.
getStateSize(self, columnIndex)
Gets the size of a field of state at the specified column index.
Parameters
columnIndex
(string) The index of the column of state.
Returns
[integer]
The size of the column.
addOutputColumn(self, columnName, dataType)
Add an output column.
Parameters
columnName
(string) The name of the column to add.
dataType
(DATA_TYPE) The data type of the column.
addOutputColumnNumeric(self, columnName, dataType, precision, scale)
Add a numeric output column.
Parameters
columnName
(string) The name of the column to add.
dataType
(DATA_TYPE) The data type of the column.
precision
(integer) The precision of the numeric to add.
scale
(integer) The scale of the numeric to add.
addOutputColumnString(self, columnName, dataType, size)
Add a string output column.
Parameters
columnName
(string) The name of the column to add.
dataType
(DATA_TYPE) The data type of the column.
size
(integer) The scale of the numeric to add.
isInputValueAvailable(self, columnIndex)
Determines if an input value is available for a shaper/sizer.
Parameters
columnName
(string) The name of the column to add.
Returns
(boolean)
TRUE if the input is available; FALSE otherwise.
isShaperSystemCatalogUpperCase(self)
Determines if the Netezza system catalog is upper case.
Returns
(boolean)
TRUE if the system catalog is upper case; FALSE otherwise.
isUdfSizer(self)
Determines if the AE is a sizer for a UDF.
Returns
(boolean)
TRUE if the AE is a UDF sizer and FALSE otherwise.
isUdtfShaper(self)
Determines if the AE is a shaper for a UDTF.
Returns
(boolean)
TRUE if the AE is a UDTF shaper; FALSE otherwise.