Filter Classes

This section describes information that is specific to the Python API. See User-Defined Filter for general information about implementing the UDFilter and FilterFactory classes.

UDFilter API

The API provides the following methods for extension by subclasses:

class PyUDFilter(vertica_sdk.UDFilter):
	def __init__(self):
		pass
	def setup(self, srvInterface):
		pass
	def process(self, srvInterface, inputbuffer, outputbuffer, inputstate):
		# User process data here, and put into outputbuffer.
		return StreamState.DONE

In Python, the process() method requires both an input buffer as well as a corresponding output buffer. The input buffer represents the source of the information that you want to filter. The output buffer delivers the filtered information to Vertica.

FilterFactory API

The API provides the following methods for extension by subclasses:

 	class PyFilterFactory(vertica_sdk.SourceFactory):
		def __init__(self):
			pass
		def plan(self):
			pass
		def prepare(self, planContext):
			#User implement the function to create PyUDSources.
			pass