Data Management

Mastering Oracle+Python, Part 4: Transactions and Large Objects

Free registration required

Executive Summary

This paper introduces the user to different aspects of transaction handling and processing of Large Objects from the Python environment. Python provides benefits of atomicity, consistency, isolation and durability. The Python Oracle database API offers a natural way of handling transactions so that logical operations on data could be stored inside the database rollback segments waiting for a final decision to commit or roll back the whole group of statements. A transaction is started with the first SQL statement reaching the database via the cursor.execute() method. The cx_Oracle.Connection.autocommit attribute can still be set to 1 making Oracle commit every single statement issued through the cursor.execute* family of methods. The two methods enable swapping of departments between given employees and giving a raise to an arbitrary number of employees. The SQL method requires the command to be parsed and executed like a normal SQL statement. Several types of LOBs are available in Oracle Database: Binary Large Object (BLOB), Character Large Object (CLOB), National Character Set Large Object (NCLOB) and External Binary File (BFILE). A LOB can be of the three defined states: NULL, empty or populated. This paper makes one familiar with the characteristics of the cx_Oracle module when it comes to dealing with transaction encapsulation and accessing all four kinds of LOBs, and also when confronted with UTF-8 encoding requirement.

  • Format: HTML
  • Size: 0 KB