Skip to main content

Fixes for the SQLAlchemy 0.4 and 0.5 Oracle driver

Project description

collective.saoraclefixes

Fix SQLAlchemy 0.4 and 0.5 Oracle quoting and offset/limit problems.

This package monkeypatches the SQLAlchemy Oracle driver with backports from the SQLAlchemy 0.6 branch. Fixes included are:

  • Reserved words. Before 0.6 no Oracle-specific reserved words were included, requiring you to rename columns and labels, making it difficult to code in a database-neutral fashion.

    Note that the oracle reserved words list in this package is a superset of the list in SQLAlchemy 0.6 (at least until SQLAlchemy branches/rel_0_6 r6245). This package includes semi-reserved identifiers as defined by the Oracle V$RESERVED_WORDS view

  • Bindparameter quoting. Using a reserved word as a bind parameter requires quoting as well. Parameters are quoted in the generated SQL code, and all use of the parameters during execution correctly uses the quoted versions.

  • Limit/offset handling. 0.6 introduces a (much) better method of implementing query limits and offsets in Oracle, following recommended Oracle practice. The 0.4/0.5 method could result in incorrect ordering, or would completely fail when sorting on a aliased column.

    The backport includes support for the optimize_limits=False dialect flag. For more information on the change, see SQLAlchemy ticket #536.

To use, simply add an import to this package:

import collective.saoraclefixes # apply oracle fixes

Note that the patches will only apply when SQLAlchemy versions 0.4 and 0.5 are used. All patching activity will be logged via python’s logger module with loglevel DEBUG.

License

collective.saoraclefixes is distributed under the MIT license, just like SQLAlchemy.

Credits

Backporting work

Martijn Pieters at Jarn

Changelog

1.2 - 2009-08-20

  • Disable FromClause.default_order_by in 0.4; 0.5 removes this functionality altogether, it’s not needed, and interferes with the quoting of rowid on Oracle.

1.1 - 2009-08-12

  • Add the improved LIMIT/OFFSET handling from 0.6.

1.0 - 2009-08-05

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.saoraclefixes-1.2.zip (12.1 kB view details)

Uploaded Source

File details

Details for the file collective.saoraclefixes-1.2.zip.

File metadata

File hashes

Hashes for collective.saoraclefixes-1.2.zip
Algorithm Hash digest
SHA256 7d37314bf3732b4fdf80c9cebe36c997d16cd27432111429de11f7f80088fe96
MD5 e6ed7379921d200b2899e68ed80949d9
BLAKE2b-256 7927d368b4510f349acad826057a6ee4f920252aa3d79693d0030cb99d280a52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page