Tie dictionary to database table?

Christian Gollwitzer auriocus at gmx.de
Fri Jun 10 03:38:47 EDT 2016


Am 10.06.16 um 09:30 schrieb Peter Heitzer:
> Michael Selik <michael.selik at gmail.com> wrote:
>> An ORM might be overkill. If you just want a persistent dictionary, just
>> use the shelve module. https://docs.python.org/3/library/shelve.html
> That looks like tie in Perl. Unfortunately I have to use mysql as database
> and I need concurrent read/write as the table may be modified by other
> processes.
> Meanwhile I have analized my demans a bit and modified the task so that I
> need not read values but rather make updates to the tables.

It wouldn't be that difficult to roll your own thing which does that; 
you just need to define __setitem__ and __getitem__ in your class which 
translates between the SQL call and the Python code.

	Christian





More information about the Python-list mailing list