Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 3a6e0844085a40c2024612b0390f0cf3 > files > 756

python-docs-2.7.13-1.1.mga6.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>11.12. dumbdbm — Portable DBM implementation &mdash; Python 2.7.13 documentation</title>
    
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7.13',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.13 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.13 documentation" href="../contents.html" />
    <link rel="up" title="11. Data Persistence" href="persistence.html" />
    <link rel="next" title="11.13. sqlite3 — DB-API 2.0 interface for SQLite databases" href="sqlite3.html" />
    <link rel="prev" title="11.11. bsddb — Interface to Berkeley DB library" href="bsddb.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 
    

  </head>
  <body role="document">  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sqlite3.html" title="11.13. sqlite3 — DB-API 2.0 interface for SQLite databases"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="bsddb.html" title="11.11. bsddb — Interface to Berkeley DB library"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.13 documentation</a> &raquo;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li class="nav-item nav-item-2"><a href="persistence.html" accesskey="U">11. Data Persistence</a> &raquo;</li> 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-dumbdbm">
<span id="dumbdbm-portable-dbm-implementation"></span><h1>11.12. <a class="reference internal" href="#module-dumbdbm" title="dumbdbm: Portable implementation of the simple DBM interface."><code class="xref py py-mod docutils literal"><span class="pre">dumbdbm</span></code></a> &#8212; Portable DBM implementation<a class="headerlink" href="#module-dumbdbm" title="Permalink to this headline">¶</a></h1>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference internal" href="#module-dumbdbm" title="dumbdbm: Portable implementation of the simple DBM interface."><code class="xref py py-mod docutils literal"><span class="pre">dumbdbm</span></code></a> module has been renamed to <code class="xref py py-mod docutils literal"><span class="pre">dbm.dumb</span></code> in Python 3.
The <a class="reference internal" href="../glossary.html#term-2to3"><span class="xref std std-term">2to3</span></a> tool will automatically adapt imports when converting your
sources to Python 3.</p>
</div>
<div class="admonition note" id="index-0">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference internal" href="#module-dumbdbm" title="dumbdbm: Portable implementation of the simple DBM interface."><code class="xref py py-mod docutils literal"><span class="pre">dumbdbm</span></code></a> module is intended as a last resort fallback for the
<a class="reference internal" href="anydbm.html#module-anydbm" title="anydbm: Generic interface to DBM-style database modules."><code class="xref py py-mod docutils literal"><span class="pre">anydbm</span></code></a> module when no more robust module is available. The <a class="reference internal" href="#module-dumbdbm" title="dumbdbm: Portable implementation of the simple DBM interface."><code class="xref py py-mod docutils literal"><span class="pre">dumbdbm</span></code></a>
module is not written for speed and is not nearly as heavily used as the other
database modules.</p>
</div>
<p>The <a class="reference internal" href="#module-dumbdbm" title="dumbdbm: Portable implementation of the simple DBM interface."><code class="xref py py-mod docutils literal"><span class="pre">dumbdbm</span></code></a> module provides a persistent dictionary-like interface which
is written entirely in Python.  Unlike other modules such as <a class="reference internal" href="gdbm.html#module-gdbm" title="gdbm: GNU's reinterpretation of dbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">gdbm</span></code></a> and
<a class="reference internal" href="bsddb.html#module-bsddb" title="bsddb: Interface to Berkeley DB database library"><code class="xref py py-mod docutils literal"><span class="pre">bsddb</span></code></a>, no external library is required.  As with other persistent
mappings, the keys and values must always be strings.</p>
<p>The module defines the following:</p>
<dl class="exception">
<dt id="dumbdbm.error">
<em class="property">exception </em><code class="descclassname">dumbdbm.</code><code class="descname">error</code><a class="headerlink" href="#dumbdbm.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Raised on dumbdbm-specific errors, such as I/O errors.  <a class="reference internal" href="exceptions.html#exceptions.KeyError" title="exceptions.KeyError"><code class="xref py py-exc docutils literal"><span class="pre">KeyError</span></code></a> is
raised for general mapping errors like specifying an incorrect key.</p>
</dd></dl>

<dl class="function">
<dt id="dumbdbm.open">
<code class="descclassname">dumbdbm.</code><code class="descname">open</code><span class="sig-paren">(</span><em>filename</em><span class="optional">[</span>, <em>flag</em><span class="optional">[</span>, <em>mode</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#dumbdbm.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Open a dumbdbm database and return a dumbdbm object.  The <em>filename</em> argument is
the basename of the database file (without any specific extensions).  When a
dumbdbm database is created, files with <code class="file docutils literal"><span class="pre">.dat</span></code> and <code class="file docutils literal"><span class="pre">.dir</span></code> extensions
are created.</p>
<p>The optional <em>flag</em> argument is currently ignored; the database is always opened
for update, and will be created if it does not exist.</p>
<p>The optional <em>mode</em> argument is the Unix mode of the file, used only when the
database has to be created.  It defaults to octal <code class="docutils literal"><span class="pre">0666</span></code> (and will be modified
by the prevailing umask).</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.2: </span>The <em>mode</em> argument was ignored in earlier versions.</p>
</div>
</dd></dl>

<p>In addition to the dictionary-like methods, <code class="docutils literal"><span class="pre">dumbdm</span></code> objects
provide the following method:</p>
<dl class="function">
<dt id="dumbdbm.close">
<code class="descclassname">dumbdbm.</code><code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dumbdbm.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the <code class="docutils literal"><span class="pre">dumbdm</span></code> database.</p>
</dd></dl>

<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt>Module <a class="reference internal" href="anydbm.html#module-anydbm" title="anydbm: Generic interface to DBM-style database modules."><code class="xref py py-mod docutils literal"><span class="pre">anydbm</span></code></a></dt>
<dd>Generic interface to <code class="docutils literal"><span class="pre">dbm</span></code>-style databases.</dd>
<dt>Module <a class="reference internal" href="dbm.html#module-dbm" title="dbm: The standard &quot;database&quot; interface, based on ndbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">dbm</span></code></a></dt>
<dd>Similar interface to the DBM/NDBM library.</dd>
<dt>Module <a class="reference internal" href="gdbm.html#module-gdbm" title="gdbm: GNU's reinterpretation of dbm. (Unix)"><code class="xref py py-mod docutils literal"><span class="pre">gdbm</span></code></a></dt>
<dd>Similar interface to the GNU GDBM library.</dd>
<dt>Module <a class="reference internal" href="shelve.html#module-shelve" title="shelve: Python object persistence."><code class="xref py py-mod docutils literal"><span class="pre">shelve</span></code></a></dt>
<dd>Persistence module which stores non-string data.</dd>
<dt>Module <a class="reference internal" href="whichdb.html#module-whichdb" title="whichdb: Guess which DBM-style module created a given database."><code class="xref py py-mod docutils literal"><span class="pre">whichdb</span></code></a></dt>
<dd>Utility module used to determine the type of an existing database.</dd>
</dl>
</div>
<div class="section" id="dumbdbm-objects">
<span id="id1"></span><h2>11.12.1. Dumbdbm Objects<a class="headerlink" href="#dumbdbm-objects" title="Permalink to this headline">¶</a></h2>
<p>In addition to the methods provided by the <a class="reference internal" href="userdict.html#UserDict.DictMixin" title="UserDict.DictMixin"><code class="xref py py-class docutils literal"><span class="pre">UserDict.DictMixin</span></code></a> class,
<code class="xref py py-class docutils literal"><span class="pre">dumbdbm</span></code> objects provide the following methods.</p>
<dl class="method">
<dt id="dumbdbm.dumbdbm.sync">
<code class="descclassname">dumbdbm.</code><code class="descname">sync</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dumbdbm.dumbdbm.sync" title="Permalink to this definition">¶</a></dt>
<dd><p>Synchronize the on-disk directory and data files.  This method is called by the
<a class="reference internal" href="#dumbdbm.dumbdbm.sync" title="dumbdbm.dumbdbm.sync"><code class="xref py py-meth docutils literal"><span class="pre">sync()</span></code></a> method of <code class="xref py py-class docutils literal"><span class="pre">Shelve</span></code> objects.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">11.12. <code class="docutils literal"><span class="pre">dumbdbm</span></code> &#8212; Portable DBM implementation</a><ul>
<li><a class="reference internal" href="#dumbdbm-objects">11.12.1. Dumbdbm Objects</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="bsddb.html"
                        title="previous chapter">11.11. <code class="docutils literal"><span class="pre">bsddb</span></code> &#8212; Interface to Berkeley DB library</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="sqlite3.html"
                        title="next chapter">11.13. <code class="docutils literal"><span class="pre">sqlite3</span></code> &#8212; DB-API 2.0 interface for SQLite databases</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/dumbdbm.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="sqlite3.html" title="11.13. sqlite3 — DB-API 2.0 interface for SQLite databases"
             >next</a> |</li>
        <li class="right" >
          <a href="bsddb.html" title="11.11. bsddb — Interface to Berkeley DB library"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.13 documentation</a> &raquo;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li class="nav-item nav-item-2"><a href="persistence.html" >11. Data Persistence</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Dec 17, 2016.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.4.4.
    </div>

  </body>
</html>