design question

Alf P. Steinbach alfps at start.no
Mon May 3 20:21:36 EDT 2010


* Tim Arnold:
> This is a question about system design I guess. I have a django
> website that allows users to change/view configuration details for
> documentation builds. The database is very small. The reason I'm using
> a database in the first place is to make it easy for users to change
> the configuration of their builds. Django makes that easy and I can go
> on to other problems, like actually building the documentation.
>
> During a build, I query the configuration database at different times
> to get the configuration I need, which results in several calls to the
> database at different points of the build process.
>
> It doesn't feel right that I'm making these calls at different times.
> I *could* make a single big call at the beginning of the build,
> basically serializing all the config data I could need into a
> dictionary or maybe a json structure. And just pass that structure
> around as needed during the build, with no more database calls needed.
>
> These builds take from a few minutes to an hour or so, with the time
> spent making db calls almost insignificant. So if time isn't a
> problem, am I wringing my hands over something that really doesn't
> matter much? I guess it just doesn't feel like the right thing to me.

Re efficiency it seems to be a complete non-issue, but correctness is much more 
important: is there any way that the config details can be (inadvertently) 
changed while the build is going on?

If so then it might be a good idea to read all relevant info up front (holding a 
lock for hours seems ungood to me).


Cheers & hth.,

- Alf



More information about the Python-list mailing list