import oracledb dbuser = 'dbahero' dbpwd = 'oracle123' dbconn = 'localhost:1521/PDBHERO' with oracledb.connect(user=dbuser, password=dbpwd, dsn=dbconn) as connection: with connection.cursor() as cursor: sql = """select 'Olá Mundo! DBAHero!' from dual""" for r in cursor.execute(sql): print(r)