How can I connect to database from python-oracledb

Im new to this. Currently I do it this way:

connect to database using custom params cx_Oracle ${DB_CONNECT_STRING}

using cx-Oracle==8.3.0

If I use this new python-oracledb module Will I have to modify my keywords ?oracledb · PyPI

How can I connect to oracle database using the new one from Robotframework?

Hello,

Switching from cx_Oracle to python-oracledb will require some changes to your code, but the process is straightforward. Here’s how you can connect to an Oracle database using python-oracledb:

import oracledb

Connect to the database

conn = oracledb.connect(user=‘your_username’, password=‘your_password’, dsn=‘your_dsn’ My Milestone Card)
Replace ‘your_username’, ‘your_password’, and ‘your_dsn’ with your actual database credentials and the Data Source Name (DSN) of your Oracle database.

For Robot Framework, you can use the Database Library to connect to the database. You’ll need to modify your keywords to accommodate the new python-oracledb module. The connection string format will be similar, but you’ll use the python-oracledb module instead of cx_Oracle. Here’s an example of how you might define a keyword to establish a connection:

*** Settings ***
Library DatabaseLibrary

*** Keywords ***
Connect To Oracle Database
${db_connect_string}= Set Variable user/your_password@your_dsn
Connect To Database Using Custom Params python-oracledb ${db_connect_string}

Remember to replace user, your_password, and your_dsn with your actual database credentials and DSN. Also, ensure that you have the python-oracledb module installed in your environment where Robot Framework is running.

I hope the information may helps you.