On Thu, 5 May 2016 21:09:19 +0200
Christoph Zwerschke <[email protected]> wrote:
> Creating such subclasses for the various tables could be an
> interesting usage pattern. You could set a _table class attribute for
> the respective table, then you don't even need to pass it to select:
> 
>    def select(self, table=None, data=None):
>      if not table: table = self._table
>      if not data: data = self
>      # ... get row and merge into _data
>      return data

And you could add in extra processing such as merging first and last
names into a "fullname" field and other table specific things.

Of course, those sorts of things should probably be handled in the
database.

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org IM:[email protected]
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to