--- /dev/null
+<%args>
+ toc
+ paged
+ comp
+ isdynamic
+ index
+ ext
+ onepage
+</%args>
+
+<%python scope="init">
+ # get the item being requested by this embedded component from the documentation tree
+ try:
+ current = toc.get_file(comp.get_name())
+ except KeyError:
+ current = None
+</%python>
+
+% if paged == 'yes':
+% if current is None:
+ <& toc, includefile = True, **ARGS &>
+% else:
+ <A name="<% current.path %>"></a>
+ <& topnav, item=current, **ARGS &>
+ <div class="sectioncontent">
+ <& formatting.myt:printitem, item=current, includefile = True, omitheader = True &>
+ </div>
+% # if/else
+% else:
+ <& toc, includefile = False, **ARGS &>
+ <div class="onepagecontent">
+% for i in toc.children:
+ <div class="section">
+
+ <A name="<% i.path %>"></a>
+ <div class="topnavmargin">
+ <& topnav, item=i, **ARGS &>
+ </div>
+
+ <& formatting.myt:printitem, item=i, includefile = False, omitheader = True &>
+ </div>
+% # for i
+ </div>
+
+% # if/else
+
+
+<%method topnav>
+ <%args>
+ isdynamic
+ paged
+ item
+ index
+ ext
+ onepage
+ </%args>
+% ispaged = (paged =='yes')
+
+<div class="topnav">
+
+<& topnavcontrol, **ARGS &>
+
+<div class="topnavsectionlink">
+
+<a href="<% ispaged and 'index' + ext or '#top' %>">Table of Contents</a>
+
+<div class="prevnext">
+% if item.previous is not None:
+Previous: <& formatting.myt:itemlink, item=item.previous, includefile=ispaged &>
+%
+
+% if item.previous is not None and item.next is not None:
+ |
+%
+
+% if item.next is not None:
+
+Next: <& formatting.myt:itemlink, item=item.next, includefile=ispaged &>
+%
+
+</div>
+</div>
+
+
+<div class="topnavmain">
+ <div class="topnavheader"><% item.description %></div>
+ <div class="topnavitems">
+ <& formatting.myt:printtoc, root = item, includefile = False, current = None, full = True &>
+ </div>
+</div>
+
+</div>
+</%method>
+
+<%method topnavcontrol>
+ <%args>
+ isdynamic
+ paged
+ index
+ ext
+ onepage
+ </%args>
+% ispaged = (paged =='yes')
+
+ <div class="topnavcontrol">
+% if ispaged:
+ View: <b>Paged</b> | <a href="<% isdynamic and index + ext + '?paged=no' or onepage + ext %>">One Page</a>
+% else:
+ View: <a href="<% index + ext %>">Paged</a> | <b>One Page</b>
+%
+ </div>
+
+</%method>
+
+<%method toc>
+ <%args>
+ toc
+ includefile = True
+ isdynamic
+ paged
+ index
+ ext
+ onepage
+ </%args>
+
+
+ <div class="maintoc">
+ <& topnavcontrol, **ARGS &>
+
+ <a name="table_of_contents"></a>
+ <span class="docheadertext">Table of Contents</span>
+
+ <a href="#full_index">(view full table)</a>
+ <br/><br/>
+
+ <div style="margin-left:50px;">
+ <& formatting.myt:printtoc, root = toc, includefile = includefile, current = None, full = False, children=False &>
+ </div>
+
+ </div>
+
+
+ <div class="maintoc">
+ <a name="full_index"></a>
+ <span class="docheadertext">Table of Contents: Full</span>
+
+ <a href="#table_of_contents">(view brief table)</a>
+ <br/><br/>
+
+ <div style="margin-left:50px;">
+ <& formatting.myt:printtoc, root = toc, includefile = includefile, current = None, full = True, children=True &>
+ </div>
+
+ </div>
+</%method>
--- /dev/null
+<%flags>inherit='document_base.myt'</%flags>
+
+
+
+<&|doclib.myt:item, name="coolthings", description="Cool Things You Can Do With SQLAlchemy" &>
+
+<&|formatting.myt:code, syntaxtype="python" &>
+# first, some imports
+from sqlalchemy.sql import *
+from sqlalchemy.schema import *
+
+
+# make a database engine based on sqlite
+import sqlalchemy.databases.sqlite as sqlite_db
+db = sqlite_db.engine('foo.db', pool_size = 10, max_overflow = 5)
+
+# define metadata for a table
+
+users = Table('users', db,
+ Column('user_id', INT),
+ Column('user_name', VARCHAR(20)),
+ Column('password', CHAR(10))
+)
+
+
+# select rows from the table
+
+query = users.select()
+cursor = query.execute()
+rows = cursor.fetchall()
+
+
+# select rows from the table where user_name=='ed'
+rows = users.select(users.c.user_name == 'ed').execute().fetchall()
+
+# make a query with a bind param
+query = select([users], users.c.user_id == bindparam('userid'))
+
+# execute with params
+rows = query.execute(userid = 7).fetchall()
+
+
+# make another table
+addresses = Table('addresses', db,
+ Column('address_id', INT),
+ Column('user_id', INT),
+ Column('street', VARCHAR(20)),
+ Column('city', VARCHAR(20)),
+ Column('state', CHAR(2)),
+ Column('zip', CHAR(5))
+)
+
+# no, really, make this table in the DB via CREATE
+addresses.build()
+
+
+# make a nonsensical query that selects from an outer join, and
+# throws in a literally-defined EXISTS clause
+query = select(
+ [users, addresses],
+ and_(
+ addresses.c.street == 'Green Street',
+ addresses.c.city == 'New York',
+ users.c.user_id != 12,
+ "EXISTS (select 1 from special_table where user_id=users.user_id)"
+ ),
+ from_obj = [ outerjoin(users, addresses, addresses.user_id==users.user_id) ]
+ )
+
+
+# insert into a table
+users.insert().execute(user_id = 7, user_name = 'jack')
+
+# update the table
+users.update(users.c.user_id == 7).execute(user_name = 'fred')
+
+
+# get DBAPI connections from the higher-level engine
+c = db.connection()
+
+
+# use the connection pooling directly:
+
+# import a real DBAPI database
+from pysqlite2 import dbapi2 as sqlite
+
+# make an implicit pool around it
+import sqlalchemy.pool as pool
+sqlite = pool.manage(sqlite, pool_size = 10, max_overflow = 5, use_threadlocal = True)
+
+# get a pooled connection local to the current thread
+c = sqlite.connect('foo.db')
+cursor = c.cursor()
+
+# return the connection to the pool
+cursor = None
+c = None
+
+</&>
+
+</&>
--- /dev/null
+<%flags>inherit="doclib.myt"</%flags>
+
+<%python scope="global">
+
+ files = [
+ 'coolthings'
+ ]
+
+</%python>
+
+<%attr>
+ files=files
+ wrapper='section_wrapper.myt'
+ onepage='documentation'
+ index='index'
+ title='SQLAlchemy Documentation'
+ version = '0.91'
+</%attr>
+
+
+
+
+
+
--- /dev/null
+/* documentation section styles */
+
+.doccontainer {
+}
+
+.panecontainer {
+}
+
+.sidebar {
+ background-color: #EEEEFB;
+ border: 1px solid;
+ padding: 5px 5px 5px 5px;
+ margin: 0px 5px 5px 0px;
+ width:120px;
+ float:left;
+}
+
+
+.sectionnavblock {
+}
+
+.sectionnav {
+ background-color: #EEEEFB;
+ border: 1px solid;
+ padding: 10px 10px 10px 10px;
+ margin: 35px 0px 15px 5px;
+ float:right;
+}
+
+
+.topnav {
+ background-color: #EEEEFB;
+ border: 1px solid;
+ padding:10px 10px 0px 10px;
+ margin:0px 0px 10px 0px;
+}
+
+.tipbox {
+ background-color: #EEEEFB;
+ border:1px solid;
+ padding:10px;
+ margin: 5px;
+}
+
+/* optional margin to add to topnav */
+.topnavmargin {
+ margin:10px;
+}
+
+.topnavsectionlink {
+ padding: 0px 0px 0px 0px;
+ margin: 0px 0px 0px 0px;
+}
+
+.topnavcontrol {
+ float:right;
+}
+
+.topnavmain {
+ margin: 25px 5px 15px 5px;
+}
+
+.topnavheader {
+ font-weight: bold;
+ font-size: 16px;
+ margin: 0px 0px 0px 0px;
+ padding:0px 0px 15px 0px;
+}
+
+.topnavitems {
+ margin: 0px 0px 0px 40px;
+}
+
+.prevnext {
+ padding: 5px 0px 0px 0px;
+}
+
+.code {
+ font-family:courier, serif;
+ font-size:12px;
+ background-color: #E2E2EB;
+ padding:2px 2px 2px 10px;
+ margin: 5px 5px 5px 5px;
+}
+
+.codetitle {
+ font-family: verdana, sans-serif;
+ font-size: 12px;
+ font-weight: bold;
+ text-decoration:underline;
+ padding:5px;
+}
+
+.codeline {
+ font-family:courier, serif;
+ font-size:12px;
+}
+
+
+.content {
+ border: 1px solid;
+ padding: 0px 10px 20px 0px;
+}
+
+.sectioncontent {
+ border: 1px solid;
+ padding: 0px 10px 20px 0px;
+}
+
+.onepagecontent {
+ border: 1px solid;
+ margin: 0px 0px 0px 0px;
+}
+
+.docheadertext {
+ font-size: 16px;
+ font-weight: bold;
+}
+
+.docheader {
+ margin: 0px 0px 10px 0px;
+}
+
+.subsection {
+ /* this style is dynamically modified by the indentation */
+ margin:15px 0px 0px 0px;
+ clear:right;
+}
+
+.section {
+ padding: 20px 0px 0px 0px;
+}
+
+.sectionheadertext {
+ font-weight: bold;
+ font-size: 16px;
+}
+
+.sectiontext {
+ font-size: 12px;
+ margin: 5px 0px 0px 0px;
+}
+
+.maintoc {
+ background-color: #EEEEFB;
+ border: 1px solid;
+ padding: 10px 10px 10px 10px;
+ margin: 0px 0px 10px 0px;
+}
+
+.toclinkcontainer {
+ padding:0px 0px 0px 8px;
+ /*border:1px solid;*/
+}
+
+.tocsection {
+ padding:2px 2px 2px 8px;
+}
+
+.toclink {
+ font-size: 12px;
+ padding:0px 0px 3px 8px;
+ /*border:1px solid;*/
+}
+
+.smalltoclink {
+ font-size: 11px;
+ padding:0px 0px 3px 0px;
+}
+