Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109781

Re: Tie dictionary to database table?

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Tie dictionary to database table?
Date 2016-06-10 14:25 +0200
Organization None
Message-ID <mailman.134.1465561692.2306.python-list@python.org> (permalink)
References (3 earlier) <mailman.126.1465512052.2306.python-list@python.org> <drv8l8Fb7nnU1@mid.individual.net> <njdqq7$cr5$1@dont-email.me> <drvkmoFdk2vU3@mid.individual.net> <njebji$ba1$1@ger.gmane.org>

Show all headers | View raw


Peter Heitzer wrote:

> Christian Gollwitzer <auriocus@gmx.de> wrote:
>>Am 10.06.16 um 09:30 schrieb Peter Heitzer:
>>> Michael Selik <michael.selik@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.
> That's a good idea.

There's an old recipe for sqlite3

http://code.activestate.com/recipes/576638-draft-for-an-sqlite3-based-dbm/

that you might adapt.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Tie dictionary to database table? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-06-09 12:30 +0000
  Re: Tie dictionary to database table? justin walters <walters.justin01@gmail.com> - 2016-06-09 06:09 -0700
  Re: Tie dictionary to database table? Michael Selik <michael.selik@gmail.com> - 2016-06-09 22:40 +0000
    Re: Tie dictionary to database table? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-06-10 07:30 +0000
      Re: Tie dictionary to database table? Christian Gollwitzer <auriocus@gmx.de> - 2016-06-10 09:38 +0200
        Re: Tie dictionary to database table? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-06-10 10:56 +0000
          Re: Tie dictionary to database table? Peter Otten <__peter__@web.de> - 2016-06-10 14:25 +0200
  Re: Tie dictionary to database table? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-16 20:59 -0700

csiph-web