From c044109e6e85535ef9604a43b26fa87a07b833ed Mon Sep 17 00:00:00 2001
From: Andre Mochinin <35140131+amochin@users.noreply.github.com>
Date: Fri, 27 Sep 2024 12:49:49 +0200
Subject: [PATCH] Allow custom params for keyword "Connect To Database" (#220)
The entire connection logic and implementation was refactored
* There is only one mandatory parameter left - dbapiModuleName, it must be set - either as keyword argument or in config file.
* All other parameters are optional now. So if some connection data was missing, the error would come not from the Database Library, but from the Python DB module.
* If some params are not provided, they are not set to None - they are just not passed to the Python DB module at all.
* Other custom params from keyword arguments and config file are passed to the Python DB module as provided
* All parameters can be now set in a config file - including any custom params
* If same custom parameter is provided both as a keyword argument and in config file, the keyword argument value takes precedence.
Other changes
* Deprecate the Connect To Database Using Custom Params Keyword - it's not needed anymore, the updated Connect To Database keyword replaces it fully
* Stop using localhost as fallback value for DB host
* Stop using {SQL Server} as fallback value for pyodbc driver
* Update docs for the Connect To Database keyword, move docs for using the config file in a separate section
---
doc/index.html | 51 ++-
src/DatabaseLibrary/__init__.py | 49 +++
src/DatabaseLibrary/connection_manager.py | 384 +++++++++++-------
test/resources/common.resource | 19 +-
.../config_files/connect_config_file.resource | 11 +
.../oracledb/custom_param_password.cfg | 6 +
.../oracledb/invalid_custom_params.cfg | 8 +
.../oracledb/simple_default_alias.cfg | 8 +
.../oracledb/some_basic_params_missing.cfg | 3 +
.../config_files/oracledb/thick_mode.cfg | 8 +
.../oracledb/valid_custom_params.cfg | 7 +
.../config_files/oracledb/wrong_password.cfg | 7 +
.../psycopg2/custom_param_password.cfg | 6 +
.../psycopg2/invalid_custom_params.cfg | 8 +
.../psycopg2/simple_default_alias.cfg | 7 +
.../psycopg2/some_basic_params_missing.cfg | 3 +
.../psycopg2/valid_custom_params.cfg | 7 +
.../config_files/psycopg2/wrong_password.cfg | 7 +
.../config_files/pymssql/charset_invalid.cfg | 8 +
.../pymssql/custom_param_password.cfg | 6 +
.../pymssql/invalid_custom_params.cfg | 8 +
.../pymssql/simple_default_alias.cfg | 7 +
.../pymssql/some_basic_params_missing.cfg | 3 +
.../pymssql/valid_custom_params.cfg | 7 +
.../config_files/pymssql/wrong_password.cfg | 7 +
.../config_files/pymysql/charset_invalid.cfg | 8 +
.../pymysql/custom_param_password.cfg | 6 +
.../pymysql/invalid_custom_params.cfg | 8 +
.../pymysql/simple_default_alias.cfg | 7 +
.../pymysql/some_basic_params_missing.cfg | 3 +
.../pymysql/valid_custom_params.cfg | 7 +
.../config_files/pymysql/wrong_password.cfg | 7 +
.../config_files/pyodbc/charset_invalid.cfg | 9 +
.../pyodbc/custom_param_password.cfg | 7 +
.../pyodbc/invalid_custom_params.cfg | 9 +
.../pyodbc/simple_default_alias.cfg | 8 +
.../pyodbc/some_basic_params_missing.cfg | 3 +
.../pyodbc/valid_custom_params.cfg | 8 +
.../config_files/pyodbc/wrong_password.cfg | 8 +
.../sqlite3/simple_default_alias.cfg | 4 +
.../common_tests/connection_params.robot | 171 ++++++++
test/tests/utests/test_connection_manager.py | 15 +-
42 files changed, 749 insertions(+), 184 deletions(-)
create mode 100644 test/resources/config_files/connect_config_file.resource
create mode 100644 test/resources/config_files/oracledb/custom_param_password.cfg
create mode 100644 test/resources/config_files/oracledb/invalid_custom_params.cfg
create mode 100644 test/resources/config_files/oracledb/simple_default_alias.cfg
create mode 100644 test/resources/config_files/oracledb/some_basic_params_missing.cfg
create mode 100644 test/resources/config_files/oracledb/thick_mode.cfg
create mode 100644 test/resources/config_files/oracledb/valid_custom_params.cfg
create mode 100644 test/resources/config_files/oracledb/wrong_password.cfg
create mode 100644 test/resources/config_files/psycopg2/custom_param_password.cfg
create mode 100644 test/resources/config_files/psycopg2/invalid_custom_params.cfg
create mode 100644 test/resources/config_files/psycopg2/simple_default_alias.cfg
create mode 100644 test/resources/config_files/psycopg2/some_basic_params_missing.cfg
create mode 100644 test/resources/config_files/psycopg2/valid_custom_params.cfg
create mode 100644 test/resources/config_files/psycopg2/wrong_password.cfg
create mode 100644 test/resources/config_files/pymssql/charset_invalid.cfg
create mode 100644 test/resources/config_files/pymssql/custom_param_password.cfg
create mode 100644 test/resources/config_files/pymssql/invalid_custom_params.cfg
create mode 100644 test/resources/config_files/pymssql/simple_default_alias.cfg
create mode 100644 test/resources/config_files/pymssql/some_basic_params_missing.cfg
create mode 100644 test/resources/config_files/pymssql/valid_custom_params.cfg
create mode 100644 test/resources/config_files/pymssql/wrong_password.cfg
create mode 100644 test/resources/config_files/pymysql/charset_invalid.cfg
create mode 100644 test/resources/config_files/pymysql/custom_param_password.cfg
create mode 100644 test/resources/config_files/pymysql/invalid_custom_params.cfg
create mode 100644 test/resources/config_files/pymysql/simple_default_alias.cfg
create mode 100644 test/resources/config_files/pymysql/some_basic_params_missing.cfg
create mode 100644 test/resources/config_files/pymysql/valid_custom_params.cfg
create mode 100644 test/resources/config_files/pymysql/wrong_password.cfg
create mode 100644 test/resources/config_files/pyodbc/charset_invalid.cfg
create mode 100644 test/resources/config_files/pyodbc/custom_param_password.cfg
create mode 100644 test/resources/config_files/pyodbc/invalid_custom_params.cfg
create mode 100644 test/resources/config_files/pyodbc/simple_default_alias.cfg
create mode 100644 test/resources/config_files/pyodbc/some_basic_params_missing.cfg
create mode 100644 test/resources/config_files/pyodbc/valid_custom_params.cfg
create mode 100644 test/resources/config_files/pyodbc/wrong_password.cfg
create mode 100644 test/resources/config_files/sqlite3/simple_default_alias.cfg
create mode 100644 test/tests/common_tests/connection_params.robot
diff --git a/doc/index.html b/doc/index.html
index 3e685f3..bed2160 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -6,9 +6,9 @@
-
+
-
-
-
-
-