<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>web2py.gluon.dal.DAL</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;web2py ::
        <a href="web2py.gluon-module.html">Package&nbsp;gluon</a> ::
        <a href="web2py.gluon.dal-module.html">Module&nbsp;dal</a> ::
        Class&nbsp;DAL
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="web2py.gluon.dal.DAL-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class DAL</h1><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL">source&nbsp;code</a></span><br /><br />
<pre class="base-tree">
object --+    
         |    
      dict --+
             |
            <strong class="uidshort">DAL</strong>
</pre>

<hr />
<p>an instance of this class represents a database connection</p>
  Example:
<pre class="literalblock">
  db = DAL('sqlite://test.db')
  db.define_table('tablename', Field('fieldname1'),
                               Field('fieldname2'))
</pre><br /><br />

<!-- ==================== NESTED CLASSES ==================== -->
<a name="section-NestedClasses"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Nested Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-NestedClasses"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Field-class.html" class="summary-name">Field</a><br />
      an instance of this class represents a database field
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Table-class.html" class="summary-name">Table</a><br />
      an instance of this class represents a database table
    </td>
  </tr>
</table>
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">uri</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">sqlite://dummy.db</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">pool_size</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">folder</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">db_codec</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">UTF-8</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">check_reserved</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">migrate</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">fake_migrate</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">migrate_enabled</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">fake_migrate_all</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">decode_credentials</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">driver_args</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">adapter_args</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>,
        <span class="summary-sig-arg">attempts</span>=<span class="summary-sig-default">5</span>,
        <span class="summary-sig-arg">auto_import</span>=<span class="summary-sig-default">True</span>)</span><br />
      Creates a new Database Abstraction Layer instance.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="import_table_definitions"></a><span class="summary-sig-name">import_table_definitions</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">path</span>,
        <span class="summary-sig-arg">migrate</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">fake_migrate</span>=<span class="summary-sig-default">True</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.import_table_definitions">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#check_reserved_keyword" class="summary-sig-name">check_reserved_keyword</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>)</span><br />
      Validates ``name`` against SQL keywords Uses self.check_reserve 
      which is a list of operators to use.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.check_reserved_keyword">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__contains__" class="summary-sig-name">__contains__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">tablename</span>)</span><br />
      Returns:
True if D has a key k, else False</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__contains__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#parse_as_rest" class="summary-sig-name">parse_as_rest</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">patterns</span>,
        <span class="summary-sig-arg">args</span>,
        <span class="summary-sig-arg">vars</span>,
        <span class="summary-sig-arg">query</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">nested_select</span>=<span class="summary-sig-default">True</span>)</span><br />
      EXAMPLE:...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.parse_as_rest">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="define_table"></a><span class="summary-sig-name">define_table</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">tablename</span>,
        <span class="summary-sig-arg">*fields</span>,
        <span class="summary-sig-arg">**args</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.define_table">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__iter__" class="summary-sig-name">__iter__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      iter(x)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__iter__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__getitem__" class="summary-sig-name">__getitem__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>)</span><br />
      x[y]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__getitem__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__setitem__" class="summary-sig-name">__setitem__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">value</span>)</span><br />
      x[i]=y</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__setitem__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__getattr__"></a><span class="summary-sig-name">__getattr__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__getattr__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__setattr__" class="summary-sig-name">__setattr__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">value</span>)</span><br />
      x.__setattr__('name', value) &lt;==&gt; x.name = value</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__setattr__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      repr(x)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__repr__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__call__"></a><span class="summary-sig-name">__call__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">query</span>=<span class="summary-sig-default">1</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__call__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="commit"></a><span class="summary-sig-name">commit</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.commit">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="rollback"></a><span class="summary-sig-name">rollback</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.rollback">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.dal.DAL-class.html#executesql" class="summary-sig-name">executesql</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">query</span>,
        <span class="summary-sig-arg">placeholders</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">as_dict</span>=<span class="summary-sig-default">True</span>)</span><br />
      placeholders is optional and will always be None when using DAL if
      using raw SQL with placeholders, placeholders may be a sequence of 
      values to be substituted in or, *if supported by the DB driver*, a 
      dictionary with keys matching named placeholders in your SQL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.executesql">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_update_referenced_by"></a><span class="summary-sig-name">_update_referenced_by</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL._update_referenced_by">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="export_to_csv_file"></a><span class="summary-sig-name">export_to_csv_file</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">ofile</span>,
        <span class="summary-sig-arg">*args</span>,
        <span class="summary-sig-arg">**kwargs</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.export_to_csv_file">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="import_from_csv_file"></a><span class="summary-sig-name">import_from_csv_file</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">ifile</span>,
        <span class="summary-sig-arg">id_map</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>,
        <span class="summary-sig-arg">null</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">&lt;NULL&gt;</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">unique</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">uuid</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">*args</span>,
        <span class="summary-sig-arg">**kwargs</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.import_from_csv_file">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>dict</code></b>:
      <code>__cmp__</code>,
      <code>__delitem__</code>,
      <code>__eq__</code>,
      <code>__ge__</code>,
      <code>__getattribute__</code>,
      <code>__gt__</code>,
      <code>__hash__</code>,
      <code>__le__</code>,
      <code>__len__</code>,
      <code>__lt__</code>,
      <code>__ne__</code>,
      <code>__new__</code>,
      <code>clear</code>,
      <code>copy</code>,
      <code>fromkeys</code>,
      <code>get</code>,
      <code>has_key</code>,
      <code>items</code>,
      <code>iteritems</code>,
      <code>iterkeys</code>,
      <code>itervalues</code>,
      <code>keys</code>,
      <code>pop</code>,
      <code>popitem</code>,
      <code>setdefault</code>,
      <code>update</code>,
      <code>values</code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__str__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== STATIC METHODS ==================== -->
<a name="section-StaticMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Static Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-StaticMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="set_folder"></a><span class="summary-sig-name">set_folder</span>(<span class="summary-sig-arg">folder</span>)</span><br />
      # ## this allows gluon to set a folder for this thread # ## 
      &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Should go away as new DAL 
      replaces old sql.py</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.set_folder">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="distributed_transaction_begin"></a><span class="summary-sig-name">distributed_transaction_begin</span>(<span class="summary-sig-arg">*instances</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.distributed_transaction_begin">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="distributed_transaction_commit"></a><span class="summary-sig-name">distributed_transaction_commit</span>(<span class="summary-sig-arg">*instances</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.distributed_transaction_commit">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">uri</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">sqlite://dummy.db</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">pool_size</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">folder</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">db_codec</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">UTF-8</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">check_reserved</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">migrate</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">fake_migrate</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">migrate_enabled</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">fake_migrate_all</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">decode_credentials</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">driver_args</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">adapter_args</span>=<span class="sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>,
        <span class="sig-arg">attempts</span>=<span class="sig-default">5</span>,
        <span class="sig-arg">auto_import</span>=<span class="sig-default">True</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">

Creates a new Database Abstraction Layer instance.

Keyword arguments:

:uri: string that contains information for connecting to a database.
       (default: 'sqlite://dummy.db')
:pool_size: How many open connections to make to the database object.
:folder: &lt;please update me&gt;
:db_codec: string encoding of the database (default: 'UTF-8')
:check_reserved: list of adapters to check tablenames and column names
                 against sql reserved keywords. (Default None)

* 'common' List of sql keywords that are common to all database types
        such as &quot;SELECT, INSERT&quot;. (recommended)
* 'all' Checks against all known SQL keywords. (not recommended)
        &lt;adaptername&gt; Checks against the specific adapters list of keywords
        (recommended)
* '&lt;adaptername&gt;_nonreserved' Checks against the specific adapters
        list of nonreserved keywords. (if available)
:migrate (defaults to True) sets default migrate behavior for all tables
:fake_migrate (defaults to False) sets default fake_migrate behavior for all tables
:migrate_enabled (defaults to True). If set to False disables ALL migrations
:fake_migrate_all (defaults to False). If sets to True fake migrates ALL tables
:attempts (defaults to 5). Number of times to attempt connecting

</pre>
  <dl class="fields">
    <dt>Returns:</dt>
        <dd><pre class="literalblock">
new empty dictionary

</pre></dd>
    <dt>Overrides:
      dict.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="check_reserved_keyword"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">check_reserved_keyword</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">name</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.check_reserved_keyword">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  Validates ``name`` against SQL keywords Uses self.check_reserve which 
  is a list of operators to use. self.check_reserved ['common', 'postgres',
  'mysql'] self.check_reserved ['all']
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="__contains__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__contains__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">tablename</span>)</span>
    <br /><em class="fname">(In operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__contains__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Returns:</dt>
        <dd><pre class="literalblock">
True if D has a key k, else False

</pre></dd>
    <dt>Overrides:
      dict.__contains__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="parse_as_rest"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">parse_as_rest</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">patterns</span>,
        <span class="sig-arg">args</span>,
        <span class="sig-arg">vars</span>,
        <span class="sig-arg">query</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">nested_select</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.parse_as_rest">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">

        EXAMPLE:

db.define_table('person',Field('name'),Field('info'))
db.define_table('pet',Field('person',db.person),Field('name'),Field('info'))

@request.restful()
def index():
    def GET(*kargs,**kvars):
        patterns = [
            &quot;/persons[person]&quot;,
            &quot;/{person.name.startswith}&quot;,
            &quot;/{person.name}/:field&quot;,
            &quot;/{person.name}/pets[pet.person]&quot;,
            &quot;/{person.name}/pet[pet.person]/{pet.name}&quot;,
            &quot;/{person.name}/pet[pet.person]/{pet.name}/:field&quot;
            ]
        parser = db.parse_as_rest(patterns,kargs,kvars)
        if parser.status == 200:
            return dict(content=parser.response)
        else:
            raise HTTP(parser.status,parser.error)
    def POST(table_name,**kvars):
        if table_name == 'person':
            return db.person.validate_and_insert(**kvars)
        elif table_name == 'pet':
            return db.pet.validate_and_insert(**kvars)
        else:
            raise HTTP(400)
    return locals()
        

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="__iter__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__iter__</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__iter__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  iter(x)
  <dl class="fields">
    <dt>Overrides:
      dict.__iter__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__getitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__getitem__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>)</span>
    <br /><em class="fname">(Indexing operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__getitem__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  x[y]
  <dl class="fields">
    <dt>Overrides:
      dict.__getitem__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__setitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__setitem__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>,
        <span class="sig-arg">value</span>)</span>
    <br /><em class="fname">(Index assignment operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__setitem__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  x[i]=y
  <dl class="fields">
    <dt>Overrides:
      dict.__setitem__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__setattr__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__setattr__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">key</span>,
        <span class="sig-arg">value</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__setattr__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  x.__setattr__('name', value) &lt;==&gt; x.name = value
  <dl class="fields">
    <dt>Overrides:
      object.__setattr__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__repr__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">self</span>)</span>
    <br /><em class="fname">(Representation operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.__repr__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  repr(x)
  <dl class="fields">
    <dt>Overrides:
      dict.__repr__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="executesql"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">executesql</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">query</span>,
        <span class="sig-arg">placeholders</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">as_dict</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DAL.executesql">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>placeholders is optional and will always be None when using DAL if 
  using raw SQL with placeholders, placeholders may be a sequence of values
  to be substituted in or, *if supported by the DB driver*, a dictionary 
  with keys matching named placeholders in your SQL.</p>
  <p>Added 2009-12-05 &quot;as_dict&quot; optional argument. Will always be
  None when using DAL. If using raw SQL can be set to True and the results 
  cursor returned by the DB driver will be converted to a sequence of 
  dictionaries keyed with the db field names. Tested with SQLite but should
  work with any database since the cursor.description used to get field 
  names is part of the Python dbi 2.0 specs. Results returned with as_dict 
  = True are the same as those returned when applying .to_list() to a DAL 
  query.</p>
  <p>[{field1: value1, field2: value2}, {field1: value1b, field2: 
  value2b}]</p>
  --bmeredyk
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Thu Aug  4 00:47:00 2011
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
