Keeping python code and database in sync

Chris Angelico rosuav at gmail.com
Fri Aug 29 09:41:18 EDT 2014


On Fri, Aug 29, 2014 at 11:31 PM, Frank Millman <frank at chagford.com> wrote:
> Right now I am writing a tool to allow users to view and modify menu
> definitions. The tool is effectively a form definition, which in my system
> is expressed in xml and stored in the database in the 'sys_form_defns'
> table. The raw xml will be uploaded as part of the commit, and will be
> downloaded when someone pulls the latest version, but it still has to be
> inserted into the database before it is accessible.
>
> It is not a problem - I can use the same mechanism that you described - but
> it will be happening quite a lot until the system settles down.

The system I described is intended for cases where each edit builds on
the previous ones - for instance, if patch 4 creates a table and patch
7 adds a column to it, you have to have done them in that order. But
for that XML data, it sounds as if each update completely overwrites
all previous ones - is this right? In that case, I'd simplify it:
after doing all the other patches (anything more complicated than
"update this one column" can still go through a patching scheme like I
described), you just hard code an overwrite that sets the appropriate
field to the current XML. You don't need to update it through all the
previous states just to get to this one.

Basically, take the simplest approach that will do what you want :)

ChrisA



More information about the Python-list mailing list