Module: validation

This module provides functions used to validate various data types used within the library.

Functions

Type validation module.

wwdtm.validation.check_database_version(connect_dict=None, database_connection=None)

Checks current database version against minimum database version.

Parameters:
  • connect_dict (dict[str, Any]) -- A dictionary containing database connection settings as required by MySQL Connector/Python

  • database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object

Returns:

True or False, based on if the current database version meets the library's minimum database version

Return type:

bool

wwdtm.validation.valid_int_id(int_id)

Validates an ID value as a signed 32-bit integer used in ID fields in MySQL tables.

Parameters:

int_id (int) -- ID number to validate

Returns:

True or False, based on if the integer falls inclusively between 0 and 2147483647

Return type:

bool

wwdtm.validation.valid_rounding_decimal_places(number_decimal_places, min_decimal_places=0, max_decimal_places=20)

Validates that number of decimal places is within the min/max values.

Parameters:
  • number_decimal_places (int) -- Number of decimal places to validate

  • min_decimal_places (int) -- Minimum number of decimal places

  • max_decimal_places (int) -- Maximum number of decimal places

Returns:

True or False, based on if the number of decimal places is within the min/max value and if it is an integer

Return type:

bool