Keeping python code and database in sync

Chris Angelico rosuav at gmail.com
Fri Aug 29 10:19:24 EDT 2014


On Sat, Aug 30, 2014 at 12:12 AM, Frank Millman <frank at chagford.com> wrote:
> Once downloaded, the 'py' files are automatically 'live', because that is
> how python works. But the xml file will just be sitting in a directory.
> *Something* has to trigger running a program that reads the xml file and
> inserts it into the database.

I'm not 100% certain of this distinction, but it depends on how your
code gets invoked.

> My idea is to put the 'version number check' in the main program 'start.py'.
> If it detects that an upgrade is required, it will display a warning message
> to the user and then run the upgrade program. The same upgrade program can
> handle both 'schema' changes and (for want of a word) 'meta-data' changes
> such as the menu definition.

Yes... or start.py can do it directly and automatically, just check
and do whatever changes are needed. That's how I'd do it.

ChrisA



More information about the Python-list mailing list