Skip to content

Commit 5ba7485

Browse files
committed
Update main docs in the lib source code
1 parent a212ff0 commit 5ba7485

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

src/DatabaseLibrary/__init__.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DatabaseLibrary(ConnectionManager, Query, Assertion):
3737
Don't forget to install the required Python database module!
3838
3939
== Usage example ==
40-
40+
=== Basic usage ===
4141
| *** Settings ***
4242
| Library DatabaseLibrary
4343
| Test Setup Connect To My Oracle DB
@@ -65,6 +65,30 @@ class DatabaseLibrary(ConnectionManager, Query, Assertion):
6565
| Check If Not Exists In Database ${sql}
6666
|
6767
68+
=== Handling multiple database connections ===
69+
| *** Settings ***
70+
| Library DatabaseLibrary
71+
| Test Setup Connect To All Databases
72+
| Test Teardown Disconnect From All Databases
73+
|
74+
| *** Keywords ***
75+
| Connect To All Databases
76+
| Connect To Database psycopg2 db db_user pass 127.0.0.1 5432
77+
| ... alias=postgres
78+
| Connect To Database pymysql db db_user pass 127.0.0.1 3306
79+
| ... alias=mysql
80+
|
81+
| *** Test Cases ***
82+
| Using Aliases
83+
| ${names}= Query select LAST_NAME from person alias=postgres
84+
| Execute Sql String drop table XYZ alias=mysql
85+
|
86+
| Switching Default Alias
87+
| Switch Database postgres
88+
| ${names}= Query select LAST_NAME from person
89+
| Switch Database mysql
90+
| Execute Sql String drop table XYZ
91+
|
6892
== Database modules compatibility ==
6993
The library is basically compatible with any [https://peps.python.org/pep-0249|Python Database API Specification 2.0] module.
7094

0 commit comments

Comments
 (0)