[Twisted-Python] [PATCH] row / reflector / sqlreflector - case insensitive tables/columns

Justin Ryan justin at gnubia.net
Mon Apr 7 00:27:46 EDT 2003


Attached is a patch (cvs diff -u) to twisted.enterprise.row (and related
code).  Specifically, it affects the following files:

twisted/enterprise/row.py
twisted/enterprise/reflector.py
twisted/enterprise/sqlreflector.py
twisted/enterprise/util.py

The purpose is to allow for case-sensitive table/column names.  For me,
there are two parts to this:

(1) lots of comparisons in twisted use string.lower
(RowObject.__getattr__(), etc..).  There, theoretically, shouldn't be
any column names that are the same except for their case, but it still
seems logical to allow for case-sensitivity.  This change depends on the
RowObject's case_sensitive_relations attribute (which must be set by
child classes).

(2) I use postgres, and postgres requires you to enclose mixed-case
relation names in double quotes.  Thus, twisted needs to quote table
names, column names, etc..  This change depends on the sqlreflector's
quote_relations attribute, which can be passed as a keyword paramater to
sqlreflector.__init__().

I have given this some basic testing, but am mostly posting it for
scrutiny whilst I continue to work on it.  I think there are some areas
that can be improved, but it works and is pretty clean.

I think that this would be an appropriate time to state my intent to
become the maintainer of the row code, since it has apparently become
abandoned.  I have several other changes in mind, including the ability
to insert new rows without setting their primary keys and such, but I
thought that I should start submitting patches for little stuff to make
sure that the code I'm writing is sane for twisted.

TIA,

-Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: row-case.diff.final
Type: text/x-patch
Size: 9837 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030406/13708381/attachment.bin 


More information about the Twisted-Python mailing list