File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ Here you can find the [keyword docs](http://marketsquare.github.io/Robotframewor
1414```
1515pip install robotframework-databaselibrary
1616```
17- # Usage example
17+ # Usage examples
18+ ## Basic usage
1819``` RobotFramework
1920*** Settings ***
2021Library DatabaseLibrary
@@ -42,6 +43,32 @@ Person Table Contains No Joe
4243 ... WHERE FIRST_NAME= 'Joe'
4344 Check If Not Exists In Database ${sql}
4445```
46+ ## Handling multiple database connections
47+ ``` RobotFramework
48+ *** Settings ***
49+ Library DatabaseLibrary
50+ Test Setup Connect To All Databases
51+ Test Teardown Disconnect From All Databases
52+
53+ *** Keywords ***
54+ Connect To All Databases
55+ Connect To Database psycopg2 db db_user pass 127.0.0.1 5432
56+ ... alias=postgres
57+ Connect To Database pymysql db db_user pass 127.0.0.1 3306
58+ ... alias=mysql
59+
60+ *** Test Cases ***
61+ Using Aliases
62+ ${names}= Query select LAST_NAME from person alias=postgres
63+ Execute Sql String drop table XYZ alias=mysql
64+
65+ Switching Default Alias
66+ Switch Database postgres
67+ ${names}= Query select LAST_NAME from person
68+ Switch Database mysql
69+ Execute Sql String drop table XYZ
70+ ```
71+
4572See more examples in the folder ` tests ` .
4673# Database modules compatibility
4774The library is basically compatible with any [ Python Database API Specification 2.0] ( https://peps.python.org/pep-0249/ ) module.
You can’t perform that action at this time.
0 commit comments