Registry / testing / robotframework-databaselibrary

robotframework-databaselibrary

JSON →
library2.4.1pypypiunverified

The Database Library for Robot Framework allows users to query databases and verify results within Robot Framework tests. It is currently at version 2.4.1 and maintains an active release cadence, with frequent minor and patch updates to introduce new features, fix bugs, and enhance compatibility.

pip install robotframework-databaselibrary
INSTALL
IMPORT
SIG · ROBOTFRAMEWORK-DAT
R
robotframework-databaselibrary
testingpythonv2.4.1
Install
1.8s avg
Import
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 0.000s · 65.9MB
glibc
py 3.103.960 runs
installs and imports cleanly · install 1.8s · import 0.000s · 25MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DatabaseLibrary
Library DatabaseLibrary
Imported directly in Robot Framework Settings table.

This example demonstrates connecting to an in-memory SQLite database, creating a table, inserting data, querying it, and asserting results using various keywords. It highlights the basic workflow without requiring external database setup beyond the library itself, as `sqlite3` is a built-in Python module.

*** Settings *** Library DatabaseLibrary *** Test Cases *** Example Database Interaction Connect To Database sqlite3 :memory: Execute SQL String CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT) Execute SQL String INSERT INTO users (name) VALUES ('Alice') Execute SQL String INSERT INTO users (name) VALUES ('Bob') ${result}= Query SELECT name FROM users WHERE id = 1 Check Query Result SELECT name FROM users WHERE id = 1 equals Alice Check Row Count SELECT * FROM users == 2 Disconnect From Database
Debug
Known issues
deprecatedKeywords `Check If Exists In Database` and `Check If Not Exists In Database` are deprecated and will be removed in future versions.
fix
Migrate to `Check Row Count` with the assertion engine, for example: `Check Row Count    SELECT id FROM person WHERE first_name = 'Franz Allan'    >=    1`.
affects: 2.0+
gotchaThe library itself does NOT include database drivers. You must manually install the appropriate Python DB API 2.0 compliant driver (e.g., `pip install pymysql` for MySQL, `pip install psycopg2` for PostgreSQL) for the database you intend to connect to.
fix
Ensure the required database driver is installed via pip before using `Connect To Database`.
affects: All
breakingSeveral parameters were renamed in version 2.0, notably `sqlScriptFileName` to `sql_script_file` and `sansTran` to `no_transaction`.
fix
Update your Robot Framework test files to use the new parameter names.
affects: 2.0+
gotchaWhen using `Check Query Result`, type mismatch issues can occur if comparing numeric database results (e.g., INTEGER) directly with string literals from Robot Framework.
fix
For versions 2.3.2 and later, use the `assert_as_string=True` parameter in `Check Query Result` to ensure all comparisons are made as strings. Alternatively, cast values in your SQL query to match expected types.
affects: <2.3.2, and 2.3.2+ if `assert_as_string` is not used
Upgrade
Version history
2.4.1latest on PyPI · released Jan 13, 2026
Audit
Dependencies
robotframeworkrequiredThe core framework this library extends.
sqlparseoptionalOptional external parser for splitting SQL strings in keywords like 'Execute SQL String' and 'Split SQL String' (v2.2.0+).
any Python DB API 2.0 compliant driverrequiredA database-specific Python driver (e.g., pymysql, psycopg2, oracledb, ibm_db, pyodbc, or built-in sqlite3) is required to connect to actual databases. This library acts as a wrapper.
Agent activity
6 hits · last 30 days
node
6
Resources
robotframework-databaselibrary — pip install robotframework-databaselibrary · libregistry