MobileBlur

web2py.gluon.dal-module.html at [eba4a35a21]
Login

web2py.gluon.dal-module.html at [eba4a35a21]

File applications/examples/static/epydoc/web2py.gluon.dal-module.html artifact ed310cf04e part of check-in eba4a35a21


<?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</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> ::
        Module&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-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module dal</h1><span class="codelink"><a href="web2py.gluon.dal-pysrc.html">source&nbsp;code</a></span><br /><br />
<pre class="literalblock">

This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro &lt;mdipierro@cs.depaul.edu&gt;
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Thanks to
    * Niall Sweeny &lt;niall.sweeny@fonjax.com&gt; for MS SQL support
    * Marcel Leuthi &lt;mluethi@mlsystems.ch&gt; for Oracle support
    * Denes
    * Chris Clark
    * clach05
    * Denes Lengyel
    * and many others who have contributed to current and previous versions

This file contains the DAL support for many relational databases,
including:
- SQLite
- MySQL
- Postgres
- Oracle
- MS SQL
- DB2
- Interbase
- Ingres
- SapDB (experimental)
- Cubrid (experimental)
- CouchDB (experimental)
- MongoDB (in progress)
- Google:nosql
- Google:sql

Example of usage:

&gt;&gt;&gt; # from dal import DAL, Field

### create DAL connection (and create DB if not exists)
&gt;&gt;&gt; db=DAL(('mysql://a:b@locahost/x','sqlite://storage.sqlite'),folder=None)

### define a table 'person' (create/aster as necessary)
&gt;&gt;&gt; person = db.define_table('person',Field('name','string'))

### insert a record
&gt;&gt;&gt; id = person.insert(name='James')

### retrieve it by id
&gt;&gt;&gt; james = person(id)

### retrieve it by name
&gt;&gt;&gt; james = person(name='James')

### retrieve it by arbitrary query
&gt;&gt;&gt; query = (person.name=='James')&amp;(person.name.startswith('J'))
&gt;&gt;&gt; james = db(query).select(person.ALL)[0]

### update one record
&gt;&gt;&gt; james.update_record(name='Jim')

### update multiple records by query
&gt;&gt;&gt; db(person.name.like('J%')).update(name='James')
1

### delete records by query
&gt;&gt;&gt; db(person.name.lower()=='jim').delete()
0

### retrieve multiple records (rows)
&gt;&gt;&gt; people = db(person).select(orderby=person.name,groupby=person.name,limitby=(0,100))

### further filter them
&gt;&gt;&gt; james = people.find(lambda row: row.name=='James').first()
&gt;&gt;&gt; print james.id, james.name
1 James

### check aggrgates
&gt;&gt;&gt; counter = person.id.count()
&gt;&gt;&gt; print db(person).select(counter).first()(counter)
1

### delete one record
&gt;&gt;&gt; james.delete_record()
1

### delete (drop) entire database table
&gt;&gt;&gt; person.drop()

Supported field types:
id string text boolean integer double decimal password upload blob time date datetime,

Supported DAL URI strings:
'sqlite://test.db'
'sqlite:memory'
'jdbc:sqlite://test.db'
'mysql://root:none@localhost/test'
'postgres://mdipierro:none@localhost/test'
'jdbc:postgres://mdipierro:none@localhost/test'
'mssql://web2py:none@A64X2/web2py_test'
'mssql2://web2py:none@A64X2/web2py_test' # alternate mappings
'oracle://username:password@database'
'firebird://user:password@server:3050/database'
'db2://DSN=dsn;UID=user;PWD=pass'
'firebird://username:password@hostname/database'
'firebird_embedded://username:password@c://path'
'informix://user:password@server:3050/database'
'informixu://user:password@server:3050/database' # unicode informix
'google:datastore' # for google app engine datastore
'google:sql' # for google app engine with sql (mysql compatible)
'teradata://DSN=dsn;UID=user;PWD=pass' # experimental 

For more info:
help(DAL)
help(Field)

</pre><br /><br />

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></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">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</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">
        <a href="web2py.gluon.dal.GAEDecimalProperty-class.html" class="summary-name">GAEDecimalProperty</a><br />
      GAE decimal implementation
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.ConnectionPool-class.html" class="summary-name">ConnectionPool</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.BaseAdapter-class.html" class="summary-name">BaseAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.SQLiteAdapter-class.html" class="summary-name">SQLiteAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.JDBCSQLiteAdapter-class.html" class="summary-name">JDBCSQLiteAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.MySQLAdapter-class.html" class="summary-name">MySQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.PostgreSQLAdapter-class.html" class="summary-name">PostgreSQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.JDBCPostgreSQLAdapter-class.html" class="summary-name">JDBCPostgreSQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.OracleAdapter-class.html" class="summary-name">OracleAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.MSSQLAdapter-class.html" class="summary-name">MSSQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.MSSQL2Adapter-class.html" class="summary-name">MSSQL2Adapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.FireBirdAdapter-class.html" class="summary-name">FireBirdAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.FireBirdEmbeddedAdapter-class.html" class="summary-name">FireBirdEmbeddedAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.InformixAdapter-class.html" class="summary-name">InformixAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.DB2Adapter-class.html" class="summary-name">DB2Adapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.TeradataAdapter-class.html" class="summary-name">TeradataAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.IngresAdapter-class.html" class="summary-name">IngresAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.IngresUnicodeAdapter-class.html" class="summary-name">IngresUnicodeAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.SAPDBAdapter-class.html" class="summary-name">SAPDBAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.CubridAdapter-class.html" class="summary-name">CubridAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.DatabaseStoredFile-class.html" class="summary-name">DatabaseStoredFile</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.UseDatabaseStoredFile-class.html" class="summary-name">UseDatabaseStoredFile</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.GoogleSQLAdapter-class.html" class="summary-name">GoogleSQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.NoSQLAdapter-class.html" class="summary-name">NoSQLAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.GAEF-class.html" class="summary-name">GAEF</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.GoogleDatastoreAdapter-class.html" class="summary-name">GoogleDatastoreAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.CouchDBAdapter-class.html" class="summary-name">CouchDBAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.MongoDBAdapter-class.html" class="summary-name">MongoDBAdapter</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Row-class.html" class="summary-name">Row</a><br />
      a dictionary that lets you do d['a'] as well as d.a this is only
        used to store a Row
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.SQLCallableList-class.html" class="summary-name">SQLCallableList</a>
    </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.DAL-class.html" class="summary-name">DAL</a><br />
      an instance of this class represents a database connection
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.SQLALL-class.html" class="summary-name">SQLALL</a><br />
      Helper class providing a comma-separated string having all the 
        field names (prefixed by table name and '.')
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Reference-class.html" class="summary-name">Reference</a>
    </td>
  </tr>
<tr class="private">
    <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>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Expression-class.html" class="summary-name">Expression</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.SQLCustomType-class.html" class="summary-name">SQLCustomType</a><br />
      allows defining of custom SQL types...
    </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 class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Query-class.html" class="summary-name">Query</a><br />
      a query object necessary to define a set.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Set-class.html" class="summary-name">Set</a><br />
      a Set represents a set of records in the database,
the records are identified by the query=Query(...) object.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Rows-class.html" class="summary-name">Rows</a><br />
      A wrapper for the return value of a select.
    </td>
  </tr>
<tr class="private">
    <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">SQLField</a><br />
      an instance of this class represents a database field
    </td>
  </tr>
<tr class="private">
    <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">SQLTable</a><br />
      an instance of this class represents a database 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">
        <a href="web2py.gluon.dal.Expression-class.html" class="summary-name">SQLXorable</a>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Query-class.html" class="summary-name">SQLQuery</a><br />
      a query object necessary to define a set.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Set-class.html" class="summary-name">SQLSet</a><br />
      a Set represents a set of records in the database,
the records are identified by the query=Query(...) object.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Rows-class.html" class="summary-name">SQLRows</a><br />
      A wrapper for the return value of a select.
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.Row-class.html" class="summary-name">SQLStorage</a><br />
      a dictionary that lets you do d['a'] as well as d.a this is only
        used to store a Row
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.DAL-class.html" class="summary-name">SQLDB</a><br />
      an instance of this class represents a database connection
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal.DAL-class.html" class="summary-name">GQLDB</a><br />
      an instance of this class represents a database connection
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></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">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</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="DEFAULT"></a><span class="summary-sig-name">DEFAULT</span>()</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#DEFAULT">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="uuid2int"></a><span class="summary-sig-name">uuid2int</span>(<span class="summary-sig-arg">uuidv</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#uuid2int">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="int2uuid"></a><span class="summary-sig-name">int2uuid</span>(<span class="summary-sig-arg">n</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#int2uuid">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="cleanup"></a><span class="summary-sig-name">cleanup</span>(<span class="summary-sig-arg">text</span>)</span><br />
      validates that the given text is clean: only contains 
      [0-9a-zA-Z_]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#cleanup">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 href="web2py.gluon.dal-module.html#sqlhtml_validators" class="summary-sig-name">sqlhtml_validators</a>(<span class="summary-sig-arg">field</span>)</span><br />
      Field type validation, using web2py's validators mechanism.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#sqlhtml_validators">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="bar_escape"></a><span class="summary-sig-name">bar_escape</span>(<span class="summary-sig-arg">item</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#bar_escape">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="bar_encode"></a><span class="summary-sig-name">bar_encode</span>(<span class="summary-sig-arg">items</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#bar_encode">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="bar_decode_integer"></a><span class="summary-sig-name">bar_decode_integer</span>(<span class="summary-sig-arg">value</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#bar_decode_integer">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="bar_decode_string"></a><span class="summary-sig-name">bar_decode_string</span>(<span class="summary-sig-arg">value</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#bar_decode_string">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="Row_unpickler"></a><span class="summary-sig-name">Row_unpickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Row_unpickler">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="Row_pickler"></a><span class="summary-sig-name">Row_pickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Row_pickler">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="Reference_unpickler"></a><span class="summary-sig-name">Reference_unpickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Reference_unpickler">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="Reference_pickler"></a><span class="summary-sig-name">Reference_pickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Reference_pickler">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="xorify"></a><span class="summary-sig-name">xorify</span>(<span class="summary-sig-arg">orderby</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#xorify">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_record"></a><span class="summary-sig-name">update_record</span>(<span class="summary-sig-arg">pack</span>,
        <span class="summary-sig-arg">a</span>=<span class="summary-sig-default"><code class="variable-group">{</code><code class="variable-group">}</code></span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#update_record">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="Rows_unpickler"></a><span class="summary-sig-name">Rows_unpickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Rows_unpickler">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="Rows_pickler"></a><span class="summary-sig-name">Rows_pickler</span>(<span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#Rows_pickler">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 href="web2py.gluon.dal-module.html#test_all" class="summary-sig-name">test_all</a>()</span><br />
      &gt;&gt;&gt; if len(sys.argv)&lt;2: db = DAL(&quot;sqlite://test.db&quot;)...</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.dal-pysrc.html#test_all">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></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">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</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">
        <a name="MAXCHARLENGTH"></a><span class="summary-name">MAXCHARLENGTH</span> = <code title="512">512</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="INFINITY"></a><span class="summary-name">INFINITY</span> = <code title="32768">32768</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal-module.html#CALLABLETYPES" class="summary-name">CALLABLETYPES</a> = <code title="(&lt;type 'function'&gt;,
 &lt;type 'function'&gt;,
 &lt;type 'builtin_function_or_method'&gt;,
 &lt;type 'instancemethod'&gt;,
 &lt;type 'builtin_function_or_method'&gt;)"><code class="variable-group">(</code>&lt;type 'function'&gt;<code class="variable-op">, </code>&lt;type 'function'&gt;<code class="variable-op">, </code>&lt;type '<code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="have_portalocker"></a><span class="summary-name">have_portalocker</span> = <code title="True">True</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="have_serializers"></a><span class="summary-name">have_serializers</span> = <code title="True">True</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="have_validators"></a><span class="summary-name">have_validators</span> = <code title="True">True</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(&quot;web2py.dal&quot;)">logging.getLogger(&quot;web2py.dal&quot;)</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="sql_locker"></a><span class="summary-name">sql_locker</span> = <code title="&lt;_RLock(None, 0)&gt;">&lt;_RLock(None, 0)&gt;</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="thread"></a><span class="summary-name">thread</span> = <code title="threading.local()">threading.local()</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="regex_dbname"></a><span class="summary-name">regex_dbname</span> = <code title="re.compile(r'^(\w+)(:\w+)*')">re.compile(r'^<code class="re-group">(</code>\w<code class="re-op">+</code><code class="re-group">)</code><code class="re-group">(</code>:\w<code class="re-op">+</code><code class="re-group">)</code><code class="re-op">*</code>')</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="table_field"></a><span class="summary-name">table_field</span> = <code title="re.compile(r'^[\w_]+\.[\w_]+$')">re.compile(r'^<code class="re-group">[</code>\w_<code class="re-group">]</code><code class="re-op">+</code>\.<code class="re-group">[</code>\w_<code class="re-group">]</code><code class="re-op">+</code>$')</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal-module.html#regex_content" class="summary-name">regex_content</a> = <code title="re.compile(r'(?P&lt;table&gt;[\w-]+)\.(?P&lt;field&gt;[\w-]+)\.(?P&lt;uuidkey&gt;[\w-]+)\
\.(?P&lt;name&gt;\w+)\.\w+$')">re.compile(r'<code class="re-group">(?P&lt;</code><code class="re-ref">table</code><code class="re-group">&gt;</code><code class="re-group">[</code>\w-<code class="re-group">]</code><code class="re-op">+</code><code class="re-group">)</code>\.<code class="re-group">(?P&lt;</code><code class="re-ref">field</code><code class="re-group">&gt;</code><code class="re-group">[</code>\w-<code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="regex_cleanup_fn"></a><span class="summary-name">regex_cleanup_fn</span> = <code title="re.compile(r'[\'&quot;\s;]+')">re.compile(r'<code class="re-group">[</code>\'&quot;\s;<code class="re-group">]</code><code class="re-op">+</code>')</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="string_unpack"></a><span class="summary-name">string_unpack</span> = <code title="re.compile(r'(?&lt;!\|)\|(?!\|)')">re.compile(r'<code class="re-group">(?&lt;!</code>\|<code class="re-group">)</code>\|<code class="re-group">(?!</code>\|<code class="re-group">)</code>')</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal-module.html#regex_python_keywords" class="summary-name">regex_python_keywords</a> = <code title="re.compile(r'^(and|del|from|not|while|as|elif|global|or|with|assert|el\
se|if|pass|yield|break|except|import|print|class|exec|in|raise|continu\
e|finally|is|return|def|for|lambda|try)$')">re.compile(r'^<code class="re-group">(</code>and<code class="re-op">|</code>del<code class="re-op">|</code>from<code class="re-op">|</code>not<code class="re-op">|</code>while<code class="re-op">|</code><code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="drivers"></a><span class="summary-name">drivers</span> = <code title="['SQLite3', 'pymysql', 'PostgreSQL']"><code class="variable-group">[</code><code class="variable-quote">'</code><code class="variable-string">SQLite3</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">pymysql</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">PostgreSQL</code><code class="variable-quote">'</code><code class="variable-group">]</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="is_jdbc"></a><span class="summary-name">is_jdbc</span> = <code title="True">True</code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="INGRES_SEQNAME"></a><span class="summary-name">INGRES_SEQNAME</span> = <code title="'ii***lineitemsequence'"><code class="variable-quote">'</code><code class="variable-string">ii***lineitemsequence</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="web2py.gluon.dal-module.html#ADAPTERS" class="summary-name">ADAPTERS</a> = <code title="{'couchdb': &lt;class 'web2py.gluon.dal.CouchDBAdapter'&gt;,
 'cubrid': &lt;class 'web2py.gluon.dal.CubridAdapter'&gt;,
 'db2': &lt;class 'web2py.gluon.dal.DB2Adapter'&gt;,
 'firebird': &lt;class 'web2py.gluon.dal.FireBirdAdapter'&gt;,
 'firebird_embedded': &lt;class 'web2py.gluon.dal.FireBirdAdapter'&gt;,
 'gae': &lt;class 'web2py.gluon.dal.GoogleDatastoreAdapter'&gt;,
 'google:datastore': &lt;class 'web2py.gluon.dal.GoogleDatastoreAdapter'&gt;\
,
..."><code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">couchdb</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.CouchDBAdapter<code class="variable-ellipsis">...</code></code>
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="regex_quotes"></a><span class="summary-name">regex_quotes</span> = <code title="re.compile(r'\'[^\']*\'')">re.compile(r'\'<code class="re-group">[^</code>\'<code class="re-group">]</code><code class="re-op">*</code>\'')</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></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">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="sqlhtml_validators"></a>
<div class="private">
<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">sqlhtml_validators</span>(<span class="sig-arg">field</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#sqlhtml_validators">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <p>Field type validation, using web2py's validators mechanism.</p>
  makes sure the content of a field is in line with the declared 
  fieldtype
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="test_all"></a>
<div class="private">
<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">test_all</span>()</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.dal-pysrc.html#test_all">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  <pre class="literalblock">


 &gt;&gt;&gt; if len(sys.argv)&lt;2: db = DAL(&quot;sqlite://test.db&quot;)
 &gt;&gt;&gt; if len(sys.argv)&gt;1: db = DAL(sys.argv[1])
 &gt;&gt;&gt; tmp = db.define_table('users',              Field('stringf', 'string', length=32, required=True),              Field('booleanf', 'boolean', default=False),              Field('passwordf', 'password', notnull=True),              Field('uploadf', 'upload'),              Field('blobf', 'blob'),              Field('integerf', 'integer', unique=True),              Field('doublef', 'double', unique=True,notnull=True),              Field('datef', 'date', default=datetime.date.today()),              Field('timef', 'time'),              Field('datetimef', 'datetime'),              migrate='test_user.table')

Insert a field

 &gt;&gt;&gt; db.users.insert(stringf='a', booleanf=True, passwordf='p', blobf='0A',                       uploadf=None, integerf=5, doublef=3.14,                       datef=datetime.date(2001, 1, 1),                       timef=datetime.time(12, 30, 15),                       datetimef=datetime.datetime(2002, 2, 2, 12, 30, 15))
 1

 Drop the table

 &gt;&gt;&gt; db.users.drop()

 Examples of insert, select, update, delete

 &gt;&gt;&gt; tmp = db.define_table('person',              Field('name'),              Field('birth','date'),              migrate='test_person.table')
 &gt;&gt;&gt; person_id = db.person.insert(name=&quot;Marco&quot;,birth='2005-06-22')
 &gt;&gt;&gt; person_id = db.person.insert(name=&quot;Massimo&quot;,birth='1971-12-21')

 commented len(db().select(db.person.ALL))
 commented 2

 &gt;&gt;&gt; me = db(db.person.id==person_id).select()[0] # test select
 &gt;&gt;&gt; me.name
 'Massimo'
 &gt;&gt;&gt; db(db.person.name=='Massimo').update(name='massimo') # test update
 1
 &gt;&gt;&gt; db(db.person.name=='Marco').select().first().delete_record() # test delete
 1

 Update a single record

 &gt;&gt;&gt; me.update_record(name=&quot;Max&quot;)
 &gt;&gt;&gt; me.name
 'Max'

 Examples of complex search conditions

 &gt;&gt;&gt; len(db((db.person.name=='Max')&amp;(db.person.birth&lt;'2003-01-01')).select())
 1
 &gt;&gt;&gt; len(db((db.person.name=='Max')&amp;(db.person.birth&lt;datetime.date(2003,01,01))).select())
 1
 &gt;&gt;&gt; len(db((db.person.name=='Max')|(db.person.birth&lt;'2003-01-01')).select())
 1
 &gt;&gt;&gt; me = db(db.person.id==person_id).select(db.person.name)[0]
 &gt;&gt;&gt; me.name
 'Max'

 Examples of search conditions using extract from date/datetime/time

 &gt;&gt;&gt; len(db(db.person.birth.month()==12).select())
 1
 &gt;&gt;&gt; len(db(db.person.birth.year()&gt;1900).select())
 1

 Example of usage of NULL

 &gt;&gt;&gt; len(db(db.person.birth==None).select()) ### test NULL
 0
 &gt;&gt;&gt; len(db(db.person.birth!=None).select()) ### test NULL
 1

 Examples of search conditions using lower, upper, and like

 &gt;&gt;&gt; len(db(db.person.name.upper()=='MAX').select())
 1
 &gt;&gt;&gt; len(db(db.person.name.like('%ax')).select())
 1
 &gt;&gt;&gt; len(db(db.person.name.upper().like('%AX')).select())
 1
 &gt;&gt;&gt; len(db(~db.person.name.upper().like('%AX')).select())
 0

 orderby, groupby and limitby

 &gt;&gt;&gt; people = db().select(db.person.name, orderby=db.person.name)
 &gt;&gt;&gt; order = db.person.name|~db.person.birth
 &gt;&gt;&gt; people = db().select(db.person.name, orderby=order)

 &gt;&gt;&gt; people = db().select(db.person.name, orderby=db.person.name, groupby=db.person.name)

 &gt;&gt;&gt; people = db().select(db.person.name, orderby=order, limitby=(0,100))

 Example of one 2 many relation

 &gt;&gt;&gt; tmp = db.define_table('dog',               Field('name'),               Field('birth','date'),               Field('owner',db.person),               migrate='test_dog.table')
 &gt;&gt;&gt; db.dog.insert(name='Snoopy', birth=None, owner=person_id)
 1

 A simple JOIN

 &gt;&gt;&gt; len(db(db.dog.owner==db.person.id).select())
 1

 &gt;&gt;&gt; len(db().select(db.person.ALL, db.dog.name,left=db.dog.on(db.dog.owner==db.person.id)))
 1

 Drop tables

 &gt;&gt;&gt; db.dog.drop()
 &gt;&gt;&gt; db.person.drop()

 Example of many 2 many relation and Set

 &gt;&gt;&gt; tmp = db.define_table('author', Field('name'),                            migrate='test_author.table')
 &gt;&gt;&gt; tmp = db.define_table('paper', Field('title'),                            migrate='test_paper.table')
 &gt;&gt;&gt; tmp = db.define_table('authorship',            Field('author_id', db.author),            Field('paper_id', db.paper),            migrate='test_authorship.table')
 &gt;&gt;&gt; aid = db.author.insert(name='Massimo')
 &gt;&gt;&gt; pid = db.paper.insert(title='QCD')
 &gt;&gt;&gt; tmp = db.authorship.insert(author_id=aid, paper_id=pid)

 Define a Set

 &gt;&gt;&gt; authored_papers = db((db.author.id==db.authorship.author_id)&amp;(db.paper.id==db.authorship.paper_id))
 &gt;&gt;&gt; rows = authored_papers.select(db.author.name, db.paper.title)
 &gt;&gt;&gt; for row in rows: print row.author.name, row.paper.title
 Massimo QCD

 Example of search condition using  belongs

 &gt;&gt;&gt; set = (1, 2, 3)
 &gt;&gt;&gt; rows = db(db.paper.id.belongs(set)).select(db.paper.ALL)
 &gt;&gt;&gt; print rows[0].title
 QCD

 Example of search condition using nested select

 &gt;&gt;&gt; nested_select = db()._select(db.authorship.paper_id)
 &gt;&gt;&gt; rows = db(db.paper.id.belongs(nested_select)).select(db.paper.ALL)
 &gt;&gt;&gt; print rows[0].title
 QCD

 Example of expressions

 &gt;&gt;&gt; mynumber = db.define_table('mynumber', Field('x', 'integer'))
 &gt;&gt;&gt; db(mynumber.id&gt;0).delete()
 0
 &gt;&gt;&gt; for i in range(10): tmp = mynumber.insert(x=i)
 &gt;&gt;&gt; db(mynumber.id&gt;0).select(mynumber.x.sum())[0](mynumber.x.sum())
 45

 &gt;&gt;&gt; db(mynumber.x+2==5).select(mynumber.x + 2)[0](mynumber.x + 2)
 5

 Output in csv

 &gt;&gt;&gt; print str(authored_papers.select(db.author.name, db.paper.title)).strip()
 author.name,paper.title
 Massimo,QCD

 Delete all leftover tables

 &gt;&gt;&gt; DAL.distributed_transaction_commit(db)

 &gt;&gt;&gt; db.mynumber.drop()
 &gt;&gt;&gt; db.authorship.drop()
 &gt;&gt;&gt; db.author.drop()
 &gt;&gt;&gt; db.paper.drop()
 

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== VARIABLES DETAILS ==================== -->
<a name="section-VariablesDetails"></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">Variables Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-VariablesDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="CALLABLETYPES"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">CALLABLETYPES</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-group">(</code>&lt;type 'function'&gt;<code class="variable-op">,</code>
 &lt;type 'function'&gt;<code class="variable-op">,</code>
 &lt;type 'builtin_function_or_method'&gt;<code class="variable-op">,</code>
 &lt;type 'instancemethod'&gt;<code class="variable-op">,</code>
 &lt;type 'builtin_function_or_method'&gt;<code class="variable-group">)</code>
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<a name="regex_content"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">regex_content</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
re.compile(r'<code class="re-group">(?P&lt;</code><code class="re-ref">table</code><code class="re-group">&gt;</code><code class="re-group">[</code>\w-<code class="re-group">]</code><code class="re-op">+</code><code class="re-group">)</code>\.<code class="re-group">(?P&lt;</code><code class="re-ref">field</code><code class="re-group">&gt;</code><code class="re-group">[</code>\w-<code class="re-group">]</code><code class="re-op">+</code><code class="re-group">)</code>\.<code class="re-group">(?P&lt;</code><code class="re-ref">uuidkey</code><code class="re-group">&gt;</code><code class="re-group">[</code>\w-<code class="re-group">]</code><code class="re-op">+</code><code class="re-group">)</code><span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
\.<code class="re-group">(?P&lt;</code><code class="re-ref">name</code><code class="re-group">&gt;</code>\w<code class="re-op">+</code><code class="re-group">)</code>\.\w<code class="re-op">+</code>$')
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<a name="regex_python_keywords"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">regex_python_keywords</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
re.compile(r'^<code class="re-group">(</code>and<code class="re-op">|</code>del<code class="re-op">|</code>from<code class="re-op">|</code>not<code class="re-op">|</code>while<code class="re-op">|</code>as<code class="re-op">|</code>elif<code class="re-op">|</code>global<code class="re-op">|</code>or<code class="re-op">|</code>with<code class="re-op">|</code>assert<code class="re-op">|</code>el<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
se<code class="re-op">|</code>if<code class="re-op">|</code>pass<code class="re-op">|</code>yield<code class="re-op">|</code>break<code class="re-op">|</code>except<code class="re-op">|</code>import<code class="re-op">|</code>print<code class="re-op">|</code>class<code class="re-op">|</code>exec<code class="re-op">|</code>in<code class="re-op">|</code>raise<code class="re-op">|</code>continu<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
e<code class="re-op">|</code>finally<code class="re-op">|</code>is<code class="re-op">|</code>return<code class="re-op">|</code>def<code class="re-op">|</code>for<code class="re-op">|</code>lambda<code class="re-op">|</code>try<code class="re-group">)</code>$')
</pre></td></tr></table>
</dd>
  </dl>
</td></tr></table>
</div>
<a name="ADAPTERS"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <h3 class="epydoc">ADAPTERS</h3>
  
  <dl class="fields">
  </dl>
  <dl class="fields">
    <dt>Value:</dt>
      <dd><table><tr><td><pre class="variable">
<code class="variable-group">{</code><code class="variable-quote">'</code><code class="variable-string">couchdb</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.CouchDBAdapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">cubrid</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.CubridAdapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">db2</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.DB2Adapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">firebird</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.FireBirdAdapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">firebird_embedded</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.FireBirdAdapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">gae</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.GoogleDatastoreAdapter'&gt;<code class="variable-op">,</code>
 <code class="variable-quote">'</code><code class="variable-string">google:datastore</code><code class="variable-quote">'</code><code class="variable-op">: </code>&lt;class 'web2py.gluon.dal.GoogleDatastoreAdapter'&gt;<code class="variable-op"></code><span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
<code class="variable-op">,</code>
<code class="variable-ellipsis">...</code>
</pre></td></tr></table>
</dd>
  </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:46:59 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>