Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'schema': 0.05; 'definitions.': 0.07; 'modify': 0.07; 'subject:code': 0.07; 'table.': 0.07; 'definition,': 0.09; 'inserted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stored': 0.12; 'wrote': 0.14; 'changes': 0.15; 'chris,': 0.16; 'multipart': 0.16; 'program?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:n 70': 0.16; 'well-known': 0.16; 'subject:python': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'mechanism': 0.19; 'solution.': 0.20; 'aug': 0.22; 'integer': 0.24; 'question': 0.24; 'downloaded': 0.26; 'header:X -Complaints-To:1': 0.27; 'ideal': 0.29; 'xml': 0.29; 'matching': 0.30; "skip:' 10": 0.31; 'directory,': 0.31; 'with,': 0.31; 'run': 0.32; 'quite': 0.32; 'fri,': 0.33; 'raw': 0.33; 'problem': 0.35; 'agree': 0.35; 'problem.': 0.35; 'tool': 0.35; 'but': 0.35; 'version': 0.36; 'really': 0.36; 'described': 0.36; 'should': 0.36; 'expressed': 0.37; 'version,': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'mentioned': 0.61; 'numbers': 0.61; 'matter': 0.61; 'simply': 0.61; 'simple': 0.61; 'first': 0.61; 'such': 0.63; 'effectively': 0.66; 'latest': 0.67; 'frank': 0.68; 'afford': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Frank Millman" Subject: Re: Keeping python code and database in sync Date: Fri, 29 Aug 2014 15:31:34 +0200 References: X-Gmane-NNTP-Posting-Host: 197.87.50.124 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.4657 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4913 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409319097 news.xs4all.nl 2843 [2001:888:2000:d::a6]:49629 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77274 "Chris Angelico" wrote in message news:CAPTjJmrJBciRuterUKWP=QTQXd8xYquM4nx+oFd-TWM5ooskbA@mail.gmail.com... > On Fri, Aug 29, 2014 at 10:42 PM, Frank Millman > wrote: >> It is a simple matter to write a program that updates the database >> automatically. The question is, what should trigger such an update? My >> first >> thought is to use a version number - store a version number in the >> working >> directory, and have a matching number in the code. If someone downloads >> the >> latest version, the numbers will no longer match, and I can run the >> upgrade >> program. > > This is a well-known problem, and there's no really perfect solution. > The first thing to consider is: What happens if someone back-levels > the program? If you can afford to say "never back-level past a schema > change", then you can simply version the schema, independently of the > code. A simple incrementing integer will do - you don't need a > multipart version number. Thanks, Chris, this sounds ideal for my current requirements. You mentioned keeping schema changes to a minimum, which I agree with, but that is not actually my main problem. 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. Frank