parsing

pdm_utils.functions.parsing.check_operator(operator, column_object)

Validates an operator’s application on a MySQL column.

Parameters
  • operator (str) – Accepted MySQL operator.

  • column_object (Column) – A SQLAlchemy Column object.

pdm_utils.functions.parsing.create_filter_key(unparsed_filter)

Creates a standardized filter string from a valid unparsed_filter.

Parameters

unparsed_filter – Formatted MySQL WHERE clause.

Returns

Standardized MySQL conditional string.

Return type

str

pdm_utils.functions.parsing.parse_cmd_list(unparsed_string_list)

Recognizes and parses MySQL WHERE clause structures from cmd lists.

Parameters

unparsed_string_list (list[str]) – Formatted MySQL WHERE clause arguments.

Returns

2-D array containing lists of statements joined by ORs.

Return type

list[list]

pdm_utils.functions.parsing.parse_cmd_string(unparsed_cmd_string)

Recognizes and parses MySQL WHERE clause structures.

Parameters

unparsed_cmd_string (str) – Formatted MySQL WHERE clause string.

Returns

2-D array containing lists of statements joined by ORs.

Return type

list[list]

pdm_utils.functions.parsing.parse_column(unparsed_column)

Recognizes and parses a MySQL structured column.

Parameters

unparsed_column (str) – Formatted MySQL column.

Returns

List containing segments of a MySQL column.

Return type

list[str]

pdm_utils.functions.parsing.parse_filter(unparsed_filter)

Recognizes and parses a MySQL structured WHERE clause.

Parameters

unparsed_filter – Formatted MySQL WHERE clause.

Returns

List containing segments of a MySQL WHERE clause.

Return type

list[str]

pdm_utils.functions.parsing.parse_in_spaces(unparsed_string_list)

Convert a list of strings to a single space separated string.

Parameters

unparsed_string_list (list[str]) – String list to be concatenated

Returns

String with parsed in whitespace.

Return type

str

pdm_utils.functions.parsing.parse_out_ends(unparsed_string)

Parse and remove beginning and end whitespace of a string.

Parameters

unparsed_string (str) – String with variable terminal whitespaces.

Returns

String with parsed and removed beginning and ending whitespace.

Return type

str

pdm_utils.functions.parsing.parse_out_spaces(unparsed_string)

Parse and remove beginning and internal white space of a string.

Parameters

unparsed_string (str) – String with variable terminal whitespaces.

Returns

String with parsed and removed beginning and ending whitespace.

Return type

str

pdm_utils.functions.parsing.translate_column(metadata, raw_column)

Converts a case-insensitve {table}.{column} str to a case-sensitive str.

Parameters
  • metadata (MetaData) – Reflected SQLAlchemy MetaData object.

  • raw_column (str) – Case-insensitive {table}.{column}.

Returns

Case-sensitive column name.

Return type

str

pdm_utils.functions.parsing.translate_table(metadata, raw_table)

Converts a case-insensitive table name to a case-sensitive str.

Parameters
  • metadata (MetaData) – Reflected SQLAlchemy MetaData object.

  • raw_table – Case-insensitive table name.

Type_table

str

Returns

Case-sensitive table name.

Return type

str