Registry /
testing / robotframework-databaselibrary
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
muslpy 3.10–3.960 runs
installs and imports cleanly · install 0.0s · import 0.000s · 65.9MB
glibcpy 3.10–3.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.fixMigrate 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.fixEnsure 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`.fixUpdate 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.fixFor 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.