webapp.pgconfig
Parses PostgreSQL config data from pickled files
Module Contents
Functions
|
Checks version for defined redirects. |
|
Find changes between vers1 and vers2. |
|
Coalesces the values from DataFrame columns in original_columns list |
|
Loads the pickled config data for pg_version into DataFrame with the |
|
Checks string values for NaN, aka it isn't equal to itself. |
|
Used by dataFrame.apply on the combined DataFrame to check version1 and |
|
Used by dataFrame.apply on the combined DataFrame to create the columns |
|
Splits changes data into new, removed, and changed. |
|
Provides counts of changes by type (new, removed, updated) to display. |
|
Converts DataFrame to HTML table with classes for formatting. |
|
Returns sorted set of Postgres parameters from all versions. |
|
Return details about pg_param over Postgres major versions. |
|
Converts a dictionary of details across versions to HTML for display on |
Attributes
Versions with data included. Add new versions to this list. |
|
List of dictionaries. Dict keys are 'version' and 'redirect'. |
|
- webapp.pgconfig.VERSIONS = ['10', '11', '12', '13', '14', '15', '16'][source]
Versions with data included. Add new versions to this list. When including pre-production versions include a non-production designation, e.g. 16beta1
- Type:
list
- webapp.pgconfig.VERSION_REDIRECTS[source]
List of dictionaries. Dict keys are ‘version’ and ‘redirect’.
- Type:
list
- webapp.pgconfig.check_redirect(version)[source]
Checks version for defined redirects.
e.g. 12beta4 redirects to 12 once the production-ready version is released.
- Parameters:
version (str) – Version to check for redirects for.
- Returns:
version – Redirected if necessary, original version if not.
- Return type:
str
- webapp.pgconfig.config_changes(vers1: int, vers2: int) pandas.DataFrame [source]
Find changes between vers1 and vers2.
- Parameters:
vers1 (int) – Version number, e.g. 11 or 16
vers2 (int) – Version number, e.g. 11 or 16
- Returns:
changed
- Return type:
pd.DataFrame
- webapp.pgconfig.squash_columns(data: pandas.DataFrame, original_columns: list, new_column: str)[source]
Coalesces the values from DataFrame columns in original_columns list into the new_column name. Drops original_columns, so can reuse one of the column names if desired. e.g short_desc and short_desc2 combined into the short_desc column.
Note: This is useful for added and removed items, NOT changed items.
- Parameters:
data (pd.DataFrame) –
original_columns (list) –
new_column (str) –
- Returns:
data_new
- Return type:
pd.DataFrame
- webapp.pgconfig.load_config_data(pg_version: int) pandas.DataFrame [source]
Loads the pickled config data for pg_version into DataFrame with the config name as the index.
Returns empty DataFrame on file read error.
- Parameters:
pg_version (int) –
- Returns:
df
- Return type:
pd.DataFrame
- webapp.pgconfig.is_NaN(input: str) bool [source]
Checks string values for NaN, aka it isn’t equal to itself.
- Parameters:
input (str) –
- Returns:
is_nan
- Return type:
bool
- webapp.pgconfig.classify_changes(row: pandas.Series) str [source]
Used by dataFrame.apply on the combined DataFrame to check version1 and version2 values, types, etc. for differences.
- Parameters:
row (pd.Series) – Row from combined DataFrame to check details.
- Returns:
changes – Changes are built as a list internally and returned as a string with a comma separated list of changes.
- Return type:
str
- webapp.pgconfig.calculate_change_display(row: pandas.Series) str [source]
Used by dataFrame.apply on the combined DataFrame to create the columns to display for changes.
- Parameters:
row (pd.Series) – Row from combined DataFrame to check details.
- Returns:
changes – Changes are built as a list internally and returned as a string with a comma separated list of changes.
- Return type:
str
- webapp.pgconfig.config_changes_html(changes: pandas.DataFrame) dict [source]
Splits changes data into new, removed, and changed.
- Parameters:
changes (pd.DataFrame) –
- Returns:
changes_html –
- Dictionary with keys:
new
removed
changed
Each item holds the string HTML for the table of the data from input DataFrame
- Return type:
dict
- webapp.pgconfig.config_changes_stats(changes: dict) dict [source]
Provides counts of changes by type (new, removed, updated) to display.
- Parameters:
changes (dict) –
- Returns:
stats
- Return type:
dict
- webapp.pgconfig._df_to_html(df)[source]
Converts DataFrame to HTML table with classes for formatting.
- Parameters:
df (pandas.DataFrame) –
- Returns:
HTML table for display.
- Return type:
str
- webapp.pgconfig.get_all_postgres_parameters() set [source]
Returns sorted set of Postgres parameters from all versions.
- Returns:
all_parameters
- Return type:
set