ParserFactory

class vertica_sdk.ParserFactory

Produces vertica_sdk.UDParser objects, which transform a raw data stream into Vertica tuples.

vertica_sdk.ParserFactory implementations should be stateless. Modifications to instance, class, or global variables might not be persisted.

classmethod canApportionParser(cls)

Return True if parsers produced by this factory can handle input states vertica_sdk.InputState.START_OF_PORTION and vertica_sdk.InputState.END_OF_PORTION. Return False otherwise.

classmethod getParserReturnType(self, serverInterface, perColumnParamReader, planContext, argTypes, returnTypes)

Set the concrete return types for a query with the provided parameters. This method will be called after plan() in a single query, and may be called multiple times.

argTypes is a vertica_sdk.SizedColumnTypes object indicating the column types of the target table. Implementations of this method should validate that these are supported types.

Parser return types should be added to returnTypes, a vertica_sdk.SizedColumnTypes object.

serverInterface is a vertica_sdk.ServerInterface object which provides access to server functionality, including session and statement parameters.

perColumnParamReader is a vertica_sdk.PerColumnParamReader object, which provides access to column-specific parameters passed to the query.

planContext is a vertica_sdk.PlanContext object which contains any data which was stored during a call to plan().

The default implementation sets the return types to be the same as the arg types.

Returns None.

classmethod getUDXFactoryType(cls)

Returns vertica_sdk.UDXType.LOAD_PARSER.

classmethod plan(self, serverInterface, perColumnParamReader, planContext)

Execute any logic required at query plan time.

This method is run once per query on the initiator node. If it raises an exception, the query will not proceed.

serverInterface is a vertica_sdk.ServerInterface object which provides access to server functionality, including session and statement parameters.

perColumnParamReader is a vertica_sdk.PerColumnParamReader object, which provides access to column-specific parameters passed to the query.

planContext is vertica_sdk.PlanContext object, for storing and retrieving data which will be serialized and distributed to all nodes which run the query plan.

classmethod prepare(self, serverInterface, perColumnParamReader, planContext, returnType)

Create a vertica_sdk.UDParser object for execution. This method is run once per load thread on each node, prior to the start of execution.

serverInterface is a vertica_sdk.ServerInterface object which provides access to server functionality, including session and statement parameters. It contains the same parameters as the ServerInterface argument to plan() in the same query.

perColumnParamReader is a vertica_sdk.PerColumnParamReader object, which provides access to column-specific parameters passed to the query. It contains the smae parameters as the ServerInterface argument to plan() in the same query.

planContext is a vertica_sdk.PlanContext object which contains any data which was stored during a call to plan().