4.6 Python

Python (also known as CPython) is a general purpose, high level scripting language well suited for rapid application development. It is influenced by languages such as C, Perl, Haskell, and Java. Python supports different programming paradigms such as procedural, object-oriented, aspect-oriented, metaprogramming and functional programming.

SQLAlchemy is an open source Python SQL toolkit and object-relational mapper (ORM) that gives application developer the full flexibility and power of SQL. SQLAlchemy’s philosophy is that SQL databases behave less and less like object collections the more size and performance start to matter, while object collections behave less and less like tables and rows the more abstraction starts to matter. It is one the prominent ORM tools in usage by Python community. You can learn more about SQLAlchemy from the site:

http://www.sqlalchemy.org/

Python has a Database Interface (DBI) specification that aims to standardize the way Python modules access different databases. It specifies the module interface, objects, and methods that are independent of the database being used.

In the following sections, we describe the open source products that IBM provides to access DB2 databases.

4.6.1 IBM_DB driver

IBM_DB is DB2 Python driver which is used to connect to IBM databases. The IBM_DB driver is the C extension module that wraps IBM Data Server Driver for ODBC and CLI APIs. It provides the means to issue SQL queries, call stored procedures, work with large objects, persistent connections, pureXML, and metadata information against IBM data servers.

4.6.2 IBM_DB_DBI wrapper

IBM_DB_DBI is a module that implements the Python DBI API. The Python DBI API is defined by the Python community, and it uses IBM_DB internally to connect to DB2 databases. It is an open source product and is written in Python. The IBM_DB_DBI provides the means to issue SQL queries, call stored procedures, work with large objects, and use pureXML.

Chapter 4. Deploying applications with DB2 189

Page 203
Image 203
IBM DB2 manual Python, Ibmdb driver, Ibmdbdbi wrapper