public marks

PUBLIC MARKS from pvergain with tags python & database

October 2007

Mastering Oracle Python, Part 2: Working with Times and Dates

Starting with the Python 2.4 release, cx_Oracle handles DATE and TIMESTAMP datatypes natively, mapping values of such columns to Python datetime objects from the datetime module. This offers certain advantages as datetime objects support arithmetic operations in-place. Built-in time zone support and several dedicated modules make Python a real time machine. The transition between Python and Oracle date/time datatypes is completely transparent to developers thanks to cx_Oracle's mapping mechanisms. Python developers might find Oracle's date arithmetic a bit odd at first, but only with a few tips it becomes completely clear and very reasonable. This part of the series will give you an in-depth understanding of date arithmetic from both Oracle and Python's point of view. Each of them offers rich support for handling date/time datatypes, so it is the programmer's choice which one to rely on. If you tend to put application logic inside the database or whether you prefer to encapsulate date/time operations in the application itself, the seamless integration of Oracle with Python offers you maximum flexibility with limited programming effort.

Mastering Oracle Python, Part 1: Querying Best Practices

Among the core principles of Python's way of doing things there is a rule about having high-level interfaces to APIs. The Database API (in this case the Oracle API) is one example. Using the cx_Oracle Python module from Computronix, you can take command over the Oracle query model while maintaining compatibility with Python Database API Specification v2.0. The model of querying databases using DB API 2.0 remains consistent for all client libraries conforming to the specification. On top of this, Anthony Tuininga, the principal developer of cx_Oracle, has added a wide set of properties and methods that expose Oracle-specific features to developers. It is absolutely possible to use only the standard methods and forget about the "extra" ones, but in this installment you won't be doing that. The concept of universal database wrappers might work in some cases but at the same time, you lose all the optimizations that the RDBMS offers.

July 2007

Dabo Application Framework for Python in Launchpad

Dabo Application Framework for Python Dabo is a 3-tier, cross-platform application development framework, written in Python atop the wxPython GUI toolkit. And while Dabo is designed to create database-centric apps, that is not a requirement. Lots of people are using Dabo for the GUI tools to create apps that have no need to connect to a database at all. Desktop applications. That's what Dabo does. It's not YAWF (yet another web framework). There are plenty of excellent web frameworks out there, so if that's what you are looking for, Dabo isn't for you. But there are almost no desktop application frameworks out there, and if you want to create applications that run on Windows, OS X or Linux, Dabo is for you! We have taken what we've learned from 25 combined years of database application development, and built an easy-to-use runtime framework that runs on all three major platforms. Dabo consists of 3 logical tiers (UI; business logic; database access) plus an umbrella application object. More information can be found at http://dabodev.com/

Canonical Releases Storm as Open Source | Ubuntu

New Python-based database communication tool represents first open source component of Launchpad LONDON, July 9, 2007 – Canonical Ltd today announced the release of Storm, a generic open source object relational mapper (ORM) for Python. Storm is designed to support communication with multiple databases simultaneously. Canonical is best known for the popular Ubuntu operating system and Launchpad, a web-based collaboration platform for open source developers. "Storm is an ORM that simplifies the development of database-backed applications in Python, especially for projects that use very large databases or multiple databases with a seamless web front-end", said Gustavo Niemeyer, lead developer of Storm at Canonical. "Storm is particularly designed to feel very natural to Python programmers, and exposes multiple databases as /stores/ in a clean and easy to use fashion." The project has been in development for more than a year for use in Canonical projects such as Launchpad, and is now publicly available under the LGPL license. This will be the first complete Launchpad component to be released as open source software. "We're excited about using Storm for Launchpad, and that it is being released as open source. Storm's API is clear and well designed, making it a joy to work with, " said Steve Alexander, Launchpad Product Manager at Canonical. "The scalability advantages of Storm's architecture are important for us to ensure that Launchpad continues to perform well as the number of Launchpad users grows." Launchpad currently includes developers data for several thousand projects and is used by tens of thousands of developers, translators, and other free software contributors. The Storm project welcomes participation, and has a new website at http://storm.canonical.com. That site includes a tutorial, and links to allow developers to download, report bugs and join the mailing list.

November 2006

Dtuple database module

(via)
This module wraps up return tuples from the fetch* methods in the Python Database API. Using this class, the return tuples can be treated as tuples, dictionaries, or objects with attributes corresponding to the column names. The module is memory efficient -- a "tuple descriptor" is shared across all result rows, and the result row "wrapper" is very lightweight. The speed is quite reasonable.

SQLAlchemy - The Database Toolkit for Python

by 7 others (via)
SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. It provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.

Python Database

(via)
There are several wrappers that provide improved or simplified interfaces to SQL databases. Some of these might be referred to as object relational mappers, or ORM in this list -- these create Pythonic objects out of database rows. Others may only help generate SQL, or provide simple mapping support.