New to dj: relational limitations
Hi,
I'm starting to investigate django while designing a web GUI for an already productive DB.
3 applications are currently maintaining the DB contents, one of them is a real-time app (email server), others are periodic background tasks.
ERM is the central design method
https://www.chaos1.de/svn-public/repos/network-tools/ERDB/trunk/database/ERD.pdf
(supplemented by use-case-modelling for the oo code)
and the implementation is in SQL:2003 (PostgreSQL 9.1):
https://www.chaos1.de/svn-public/repos/network-tools/ERDB/trunk/database/erdb.sql
https://www.chaos1.de/svn-public/repos/network-tools/ERDB/trunk/database/dd.sql
I was impressed, how well inspectdb turned my schema into classes (100% automatic) after working around the missing schema concept in dj (I have a operational and a development DB both with a set of identical schemas). (I learned that schemas will be supported in 1.5).
The next step (after working through the tutorial) was to make some of my tables accessible in the admin site, which exposed some limitations of inspectdb (the SQL standard describes how to get meta data from the INFORMATION SCHEMA, which all RDBMS must implement, in an vendor independent manner):
SERIAL was not mapped to AutoField (all my primary keys have either SERIAL or BIGSERIAL),
no AutoField with BigInteger (AFAICS),
referential constraint action was not mapped to ForeignKey.on_delete,
ENUM type not supprted (I found a way to create one as custom field),
custom types not mapped to their (standard) parent types,
but the real stopper was that dj does not support NULL on TEXT columns.
Mapping empty strings in the GUI to NULLs in the DB and vice versa would be acceptable (as done with Oracle), but simply not allowing NULLs at all is a serious breaking with relational technology.
Some examples:
If I have defined a DEFAULT on a columns, it will be used by the backend on NULL but not on empty string.
Similar with CONSTRAINTs and RULEs or DOMAINs with CONSTRAINTs (see dd.sql above): They all fail with empty string on NULLable field but not with NULL, like:
CREATE DOMAIN dd.secondLevelDomain
AS CHARACTER VARYING(75) -- '64+"."+10'
CHECK(VALUE ~ E'^[a-z][-a-z0-9]+\.[a-z]{2,10}$');
So this would require to rewrite lots of code, stored procedures and schema definition, which is not acceptable.
Questions:
Is a work-around available?
Can one be created?
Perhaps a custom subclass of backends.postgresql_psycopg2.* ?
Thanks vor listening,
Axel
---
PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home