|
|
A patch to Django trunk that enables Firebird (version 1.5 and later) RDBMS support.
It is based on the original Django patch from ticket #1261 written by David Elias, Lucas Almad Linhard and me (Ivan Illarionov).
This is alpha software - use it at your own risk.
To install, get the latest KInterbasDB package, apply the patch in the root directory of Django trunk and run svn up. firebird will be added to default Django backends.
On UNIX-based systems setup will look like this:
svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk-firebird ln -s `pwd`/django-trunk-firebird/django SITE-PACKAGES-DIR/django cd django-trunk-firebird patch -p0 -i PATH-TO-THE-PATCH svn up
To install newer version of the patch you may need to svn revert previous patch or use the fresh checkout.
Known issues
- Complex queries with model inheritance produce wrong results with Firebird < 2.0.
- Few generic relations queries don't work properly with Firebird < 2.0.
- Few other complex queries don't work with all Firebird versions.
Everything else seems to work.
Differences from other Django backends
- TextField. Since large and very large VARCHARs work better than BLOBs with Firebird in most cases where Django uses TextField, Firebird backend uses VARCHAR columns for TextFields and BLOB columns for LargeTextField. For more info see http://www.volny.cz/iprenosil/interbase/ip_ib_strings.htm#_strings_blob_varchar.
With Firebird backend TextFields have max_length and encoding attributes that are ignored by other backends.
By default, TextFields have max_length of 10921 (with default UNICODE_FSS 3-byte charset), 8191 (with optional 4-byte UTF8 charset) or 32765 (with custom 1-byte encoding) -- maximum allowed. If there are multiple TextFields, their size could be adjusted to fit the 64k row limit and warning will be genererated. It's better to set explicit max_length attribute in this situation.
If you need to store more text you could use LargeTextField or split your text across multiple rows.
LargeTextFields can be better if you need to store Python pickles (even small), XML or source code.
- Index Limit. 252 bytes with Firebird < 2.0 and 1/4 of page size in later versions. You may need to add encoding="ascii" and/or adjust max_length of CharFields used as indexes or unique/primary keys to work around these Firebird limitations. Current implementation adjusts these fields automagically and generates warnings during validation process. It's better to adjust these fields manually or switch to Firebird > 2.0 and/or increase the page size.
- Foreign Key Constraints. FK constraint in Firebird are stricter - no forward references allowed, even inside transactions.
