queryutils.parse

queryutils.parse.extract_schema(query)[source]

Return the schema for the query.

This functionality is experimental.

Parameters:query (str) – The query string for which to extract the schema
Return type:splparser.schema.Schema
queryutils.parse.extract_template(query)[source]

Return the template for the query.

Parameters:query (str) – The query string for which to extract the template
Return type:splparser.parsetree.ParseTreeNode
queryutils.parse.lookup_commands(querystring)[source]

Extract the list of commands from the query.

Parameters:querystring (str) – The query to extract commands from
Return type:list
queryutils.parse.parse_queries(queries)[source]

TODO: Delete me.

queryutils.parse.parse_query(query)[source]

Parse the given query if possible.

This function is a small wrapper for splparser’s parse function that handles unicode issues and logs errors and returns None in the case of an error rather than raising an exception.

Parameters:query (str) – The query to parse
Return type:splparser.parsetree.ParseTreeNode
queryutils.parse.split_query_into_stages(query)[source]

Split the query into stages.

This takes a query string and returns a list of strings that represent the query stages. This is trickier than just calling split(‘|’) because the pipe character is a valid argument to commands if quoted.

Parameters:query (str) – The query to split
Return type:list
queryutils.parse.tag_parseable(query)[source]

TODO: Delete me.

queryutils.parse.tokenize_query(query)[source]

Tokenize the given query if possible.

This function is a wrapper for splparser’s tokenizer that handles unicode issues and logs errors and returns None in the case of an error rather than raising an exception.

Parameters:query (str) – The query to tokenize
Return type:list