-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
42 changed files
with
749 additions
and
184 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*** Settings *** | ||
Resource ../common.resource | ||
|
||
|
||
*** Keywords *** | ||
Connect Using Config File | ||
[Documentation] `File name` is only name without extension, | ||
... the path is build relative to the resource directory | ||
[Arguments] ${File name}=${None} &{Params} | ||
${Path}= Set Variable ${CURDIR}/${File name}.cfg | ||
Connect To Database dbConfigFile=${Path} &{Params} |
6 changes: 6 additions & 0 deletions
6
test/resources/config_files/oracledb/custom_param_password.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=1521 |
8 changes: 8 additions & 0 deletions
8
test/resources/config_files/oracledb/invalid_custom_params.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=1521 | ||
blah=blah |
8 changes: 8 additions & 0 deletions
8
test/resources/config_files/oracledb/simple_default_alias.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=1521 | ||
driverMode=thin |
3 changes: 3 additions & 0 deletions
3
test/resources/config_files/oracledb/some_basic_params_missing.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=1521 | ||
driverMode=thick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
user=db_user | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=1521 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=oracledb | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=wrong | ||
dbHost=127.0.0.1 | ||
dbPort=1521 |
6 changes: 6 additions & 0 deletions
6
test/resources/config_files/psycopg2/custom_param_password.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=5432 |
8 changes: 8 additions & 0 deletions
8
test/resources/config_files/psycopg2/invalid_custom_params.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=5432 | ||
blah=blah |
7 changes: 7 additions & 0 deletions
7
test/resources/config_files/psycopg2/simple_default_alias.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=5432 |
3 changes: 3 additions & 0 deletions
3
test/resources/config_files/psycopg2/some_basic_params_missing.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db | ||
user=db_user | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=psycopg2 | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=wrong | ||
dbHost=127.0.0.1 | ||
dbPort=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
user=SA | ||
password=MyPass1234! | ||
dbHost=127.0.0.1 | ||
dbPort=1433 | ||
dbCharset=wrong |
6 changes: 6 additions & 0 deletions
6
test/resources/config_files/pymssql/custom_param_password.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
password=MyPass1234! | ||
dbHost=127.0.0.1 | ||
dbPort=1433 |
8 changes: 8 additions & 0 deletions
8
test/resources/config_files/pymssql/invalid_custom_params.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
dbUsername=SA | ||
dbPassword=MyPass1234! | ||
dbHost=127.0.0.1 | ||
dbPort=1433 | ||
blah=blah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
dbUsername=SA | ||
dbPassword=MyPass1234! | ||
dbHost=127.0.0.1 | ||
dbPort=1433 |
3 changes: 3 additions & 0 deletions
3
test/resources/config_files/pymssql/some_basic_params_missing.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
user=SA | ||
password=MyPass1234! | ||
dbHost=127.0.0.1 | ||
dbPort=1433 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymssql | ||
dbName=db | ||
dbUsername=SA | ||
dbPassword=wrong | ||
dbHost=127.0.0.1 | ||
dbPort=1433 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
user=db_user | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbCharset=wrong |
6 changes: 6 additions & 0 deletions
6
test/resources/config_files/pymysql/custom_param_password.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 |
8 changes: 8 additions & 0 deletions
8
test/resources/config_files/pymysql/invalid_custom_params.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
blah=blah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 |
3 changes: 3 additions & 0 deletions
3
test/resources/config_files/pymysql/some_basic_params_missing.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
user=db_user | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pymysql | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=wrong | ||
dbHost=127.0.0.1 | ||
dbPort=3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db | ||
user=db_user | ||
password=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbDriver={MySQL ODBC 8.0 ANSI Driver} | ||
dbCharset=wrong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db | ||
PWD=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbDriver={MySQL ODBC 8.0 ANSI Driver} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbDriver={MySQL ODBC 8.0 ANSI Driver} | ||
blah=blah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db | ||
dbUsername=db_user | ||
dbPassword=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbDriver={MySQL ODBC 8.0 ANSI Driver} |
3 changes: 3 additions & 0 deletions
3
test/resources/config_files/pyodbc/some_basic_params_missing.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[default] | ||
dbapiModuleName=pyodbc | ||
dbName=db | ||
UID=db_user | ||
PWD=pass | ||
dbHost=127.0.0.1 | ||
dbPort=3306 | ||
dbDriver={MySQL ODBC 8.0 ANSI Driver} |
Oops, something went wrong.