snippets_py
Integration
New integration from credential
oracle_pool = yepcode.integration.oracle('credential-slug')
New integration from plain authentication data
import oracledb
oracle_pool = oracledb.create_pool(
user='username',
password='password',
dsn='connectionString'
)
Close Pool
Close pool
oracle_pool.close()
Get connection from pool
Get connection from pool
connection = oracle_pool.acquire()
Close Connection
Close connection
connection.close()
SELECT Text Only
SELECT text only
cursor = connection.cursor()
try:
cursor.execute('SELECT id, name, email FROM Persons')
row = cursor.fetchone()
while row:
print(row)
row = cursor.fetchone()
except (oracledb.IntegrityError as error):
print(error)
cursor.close()
SELECT Parametrized with Array
SELECT parametrized with array
cursor = connection.cursor()
try:
cursor.execute(
'SELECT * FROM Persons where firstName = :0 and lastName = :1',
['firstName', 'lastName']
)
row = cursor.fetchone()
while row:
print(row)
row = cursor.fetchone()
except (oracledb.IntegrityError as error):
print(error)
cursor.close()
SELECT Parametrized with Dict
SELECT parametrized with object (async/await)
cursor = connection.cursor()
try:
cursor.execute(
'SELECT * FROM Persons where firstName = :firstName and lastName = :lastName',
{
firstName: 'firstName',
lastName: 'lastName'
}
)
row = cursor.fetchone()
while row:
print(row)
row = cursor.fetchone()
except (oracledb.IntegrityError as error):
print(error)
cursor.close()