Appending data to a json file

Dave dboland9 at fastmail.fm
Tue Apr 4 14:05:28 EDT 2017


On 04/04/2017 01:50 PM, Rob Gaddi wrote:
> On 04/04/2017 10:23 AM, Dave wrote:
>
>>
>> I don't care for the idea of replacing the data file for every save. My
>> preference would to append to the existing data file - makes more sense.
>> However, that is not how json works.  So, I'm considering other
>> alternatives for a data file structure.  Paired data (key and value) is
>> not really required, but my feeling is that it makes the data file more
>> robust.  A database seems a little over the top for this situation since
>> there is no querying of data - just load and save.
>>
>> Dave,
>
> Valid.  That said, the database implementation (especially if you just
> use Sqlite) is written, done, and works.  There are reasons that a lot
> of programs use it just to store things like user settings.  Having a
> backend that's already ACID takes a lot of stress out of things like
> what I'm assuming you don't like about full data file replacement: what
> happens if you get a powerfail midway through.
>
> I'm not saying it's the right answer, but it's not nearly so much
> flyswatting with a sledgehammer as you may think.
>
>
I'll take a look at it.  Thanks!

Dave,



More information about the Python-list mailing list