-
-% if onepage or item.depth > 1:
-% if (item.next and item.next.depth >= item.depth):
- back to section top
-%
-% else:
- back to section top
- <& nav.myt:pagenav, item=item, onepage=onepage &>
-%
-
-
-%method>
-
-
-<%method formatplain>
- <%filter>
- import re
-# f = re.sub(r'\n[\s\t]*\n[\s\t]*', '
\n
', f)
- f = re.sub(r'\n[\s\t]*', '
\n
', f)
- f = "
" + f + "
"
- return f
- %filter>
-<% m.content() | h%>
-%method>
-
-
-
-
-<%method codeline trim="both">
-<% m.content() %>
-%method>
-
-<%method code autoflush=False>
-<%args>
- title = None
- syntaxtype = 'python'
- html_escape = False
- use_sliders = False
-%args>
-
-<%init>
- def fix_indent(f):
- f =string.expandtabs(f, 4)
- g = ''
- lines = string.split(f, "\n")
- whitespace = None
- for line in lines:
- if whitespace is None:
- match = re.match(r"^([ ]*).+", line)
- if match is not None:
- whitespace = match.group(1)
-
- if whitespace is not None:
- line = re.sub(r"^%s" % whitespace, "", line)
-
- if whitespace is not None or re.search(r"\w", line) is not None:
- g += (line + "\n")
-
-
- return g.rstrip()
-
- p = re.compile(r'
-% if item.previous is not None:
-Previous: <& itemlink, item=item.previous, anchor=False &>
-%
-
-% if item.previous is not None and item.next is not None:
- |
-%
-
-% if item.next is not None:
-
-Next: <& itemlink, item=item.next, anchor=False &>
-%
-
-
-
-% if item.previous is not None:
- Previous: <& itemlink, item=item.previous, usefilename=not onepage &>
-% # end if
-
-% if item.next is not None:
-% if item.previous is not None:
- |
-% # end if
-
- Next: <& itemlink, item=item.next, usefilename=not onepage &>
-% # end if
-
-
-
-%method>
diff --git a/doc/build/components/pydoc.myt b/doc/build/components/pydoc.myt
deleted file mode 100644
index 48d06ff897..0000000000
--- a/doc/build/components/pydoc.myt
+++ /dev/null
@@ -1,111 +0,0 @@
-<%doc>pydoc.myt - provides formatting functions for printing docstring.AbstractDoc generated python documentation objects.%doc>
-
-<%global>
-import docstring
-import sys
-
-def trim(docstring):
- if not docstring:
- return ''
- # Convert tabs to spaces (following the normal Python rules)
- # and split into a list of lines:
- lines = docstring.expandtabs().splitlines()
- # Determine minimum indentation (first line doesn't count):
- indent = sys.maxint
- for line in lines[1:]:
- stripped = line.lstrip()
- if stripped:
- indent = min(indent, len(line) - len(stripped))
- # Remove indentation (first line is special):
- trimmed = [lines[0].strip()]
- if indent < sys.maxint:
- for line in lines[1:]:
- trimmed.append(line[indent:].rstrip())
- # Strip off trailing and leading blank lines:
- while trimmed and not trimmed[-1]:
- trimmed.pop()
- while trimmed and not trimmed[0]:
- trimmed.pop(0)
- # Return a single string:
- return '\n'.join(trimmed)
-
-%global>
-
-<%method obj_doc>
- <%args>
- obj
- toc
- extension
- %args>
-<%init>
-if obj.isclass:
- links = []
- for elem in obj.inherits:
- if isinstance(elem, docstring.ObjectDoc):
- links.append(m.scomp("nav.myt:toclink", toc=toc, path=elem.toc_path, extension=extension, description=elem.name))
- else:
- links.append(str(elem))
- htmldescription = "class " + obj.classname + "(%s)" % (','.join(links))
-else:
- htmldescription = obj.description
-
-%init>
-
-<&|formatting.myt:section, toc=toc, path=obj.toc_path, description=htmldescription &>
-
<% trim(obj.doc) |h %>
-
-% if not obj.isclass and obj.functions:
-
-<&|formatting.myt:section, toc=toc, path=obj.mod_path &>
-% for func in obj.functions:
- <& SELF:function_doc, func=func &>
-%
-&>
-
-% else:
-
-% if obj.functions:
-% for func in obj.functions:
-% if isinstance(func, docstring.FunctionDoc):
- <& SELF:function_doc, func=func &>
-% elif isinstance(func, docstring.PropertyDoc):
- <& SELF:property_doc, prop=func &>
-%
-%
-%
-%
-
-% if obj.classes:
-% for class_ in obj.classes:
- <& SELF:obj_doc, obj=class_, toc=toc, extension=extension &>
-%
-%
-&>
-%method>
-
-<%method function_doc>
- <%args>func%args>
-
- <& printtoc, root = toc, current = None, full = True, children=True, extension=extension, anchor_toplevel=False, onepage=onepage &>
-
-
-
-%method>
-
-
-<%method printtoc>
-<%args>
- root
- current = None
- full = False
- children = True
- extension
- anchor_toplevel=False
- onepage=False
-%args>
-
-
-% for i in root.children:
- <& printtocelement, item=i, bold = (i == current), full = full, children=children, extension=extension, anchor_toplevel=anchor_toplevel,onepage=onepage &>
-%
-
-%method>
-
-<%def printtocelement>
-<%doc>prints a TOCElement as a table of contents item and prints its immediate child items%doc>
- <%args>
- item
- bold = False
- full = False
- children = True
- extension
- anchor_toplevel
- onepage=False
- %args>
-
-
-% for i in item.children:
- <& printsmtocelem, item = i, extension=extension, onepage=onepage, children=children &>
-%
-
-%
-
-%def>
diff --git a/doc/build/content/datamapping.txt b/doc/build/content/datamapping.txt
index ba70e05a08..db26fa0306 100644
--- a/doc/build/content/datamapping.txt
+++ b/doc/build/content/datamapping.txt
@@ -130,6 +130,8 @@ Some of the above examples above illustrate the usage of the mapper's Table obje
{python}
userlist = session.query(User).select(User.c.user_id==12)
+Full documentation for Query's API : [Query](rel:docstrings_sqlalchemy.orm.query_Query).
+
### Saving Objects {@name=saving}
When objects corresponding to mapped classes are created or manipulated, all changes are logged by the `Session` object. The changes are then written to the database when an application calls `flush()`. This pattern is known as a *Unit of Work*, and has many advantages over saving individual objects or attributes on those objects with individual method invocations. Domain models can be built with far greater complexity with no concern over the order of saves and deletes, excessive database round-trips and write operations, or deadlocking issues. The `flush()` operation batches its SQL statements into a transaction, and can also perform optimistic concurrency checks (using a version id column) to ensure the proper number of rows were in fact affected (not supported with the current MySQL drivers).
diff --git a/doc/build/content/docstrings.html b/doc/build/content/docstrings.html
new file mode 100644
index 0000000000..e8b480f29b
--- /dev/null
+++ b/doc/build/content/docstrings.html
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+<%inherit file="content_layout.html"/>
+<%page args="toc, extension, paged"/>
+<%namespace name="formatting" file="formatting.html"/>
+<%namespace name="nav" file="nav.html"/>
+<%namespace name="pydoc" file="pydoc.html"/>
+<%def name="title()">SQLAlchemy 0.3 Documentation - Modules and Classes%def>
+<%!
+ filename = 'docstrings'
+%>
diff --git a/doc/build/content/docstrings.myt b/doc/build/content/docstrings.myt
deleted file mode 100644
index 685c0314fa..0000000000
--- a/doc/build/content/docstrings.myt
+++ /dev/null
@@ -1,19 +0,0 @@
-<%flags>inherit='content_layout.myt'%flags>
-<%attr>
- title='Modules and Classes'
- filename='docstrings'
-%attr>
-<%args>
- toc
- extension
-%args>
-<%init>
- import cPickle as pickle
- import os
- filename = os.path.join(os.path.dirname(self.file), 'compiled_docstrings.pickle')
- data = pickle.load(file(filename))
-%init>
-
-% for obj in data:
-<& pydoc.myt:obj_doc, obj=obj, toc=toc, extension=extension &>
-%
diff --git a/doc/build/content/documentation.html b/doc/build/content/documentation.html
new file mode 100644
index 0000000000..c850749b3b
--- /dev/null
+++ b/doc/build/content/documentation.html
@@ -0,0 +1,25 @@
+<%inherit file="base.html"/>
+<%namespace name="tocns" file="toc.html"/>
+<%namespace name="nav" file="nav.html"/>
+<%page args="toc, extension"/>
+
+${tocns.toc(toc, extension=extension, paged=False)}
+
+<%def name="title()">
+ SQLAlchemy Documentation
+%def>
+
+% for file in toc.filenames:
+ <%
+ item = toc.get_by_file(file)
+ %>
+
+
+
+ % if not item.requires_paged:
+ ${nav.pagenav(item=item, paged=False, extension=extension)}
+
+ ${self.get_namespace(file + '.html').body(toc=toc, extension=extension, paged=False)}
+ % endif
+% endfor
+
diff --git a/doc/build/content/documentation.myt b/doc/build/content/documentation.myt
deleted file mode 100644
index af73c2a610..0000000000
--- a/doc/build/content/documentation.myt
+++ /dev/null
@@ -1,20 +0,0 @@
-<%flags>inherit='base.myt'%flags>
-<%args>
- extension
- toc
-%args>
-<%method title>
- SQLAlchemy Documentation
-%method>
-<& index.myt, toc=toc, extension=extension, onepage=True &>
-% for file in toc.filenames:
-% current = toc.get_by_file(file)
-
-<& nav.myt:pagenav, item=current, extension=extension, onepage=True &>
-
+ % endif
+
+ ${content}
+
+ % if (subsection and item.next and item.next.depth >= item.depth) or not subsection:
+ % if paged:
+ back to section top
+ % else:
+ back to section top
+ % endif
+ % endif
+
+
+%def>
+
+
+<%def name="formatplain()" filter="plainfilter">
+ ${ caller.body() | h}
+%def>
+
+
+<%def name="codeline()" filter="trim,h">
+ ${ caller.body() }
+%def>
+
+<%def name="code(title=None, syntaxtype='mako', html_escape=False, use_sliders=False)">
+ <%
+ def fix_indent(f):
+ f =string.expandtabs(f, 4)
+ g = ''
+ lines = string.split(f, "\n")
+ whitespace = None
+ for line in lines:
+ if whitespace is None:
+ match = re.match(r"^([ ]*).+", line)
+ if match is not None:
+ whitespace = match.group(1)
+
+ if whitespace is not None:
+ line = re.sub(r"^%s" % whitespace, "", line)
+
+ if whitespace is not None or re.search(r"\w", line) is not None:
+ g += (line + "\n")
+
+
+ return g.rstrip()
+
+ p = re.compile(r'
+ % if item.up:
+ Up: ${itemlink(item=item.up, paged=paged, anchor=not paged, extension=extension)}
+ % endif
+
+ % if item.previous is not None:
+ ${item.up is not None and " | " or ""}
+ Previous: ${itemlink(item=item.previous, paged=paged, anchor=not paged, extension=extension)}
+ % endif
+
+ % if item.next is not None:
+ ${item.previous is not None and " | " or ""}
+ Next: ${itemlink(item=item.next, paged=paged, anchor=not paged, extension=extension)}
+ % endif
+
+%def>
\ No newline at end of file
diff --git a/doc/build/templates/pydoc.html b/doc/build/templates/pydoc.html
new file mode 100644
index 0000000000..72e31e0d99
--- /dev/null
+++ b/doc/build/templates/pydoc.html
@@ -0,0 +1,114 @@
+<%doc>pydoc.myt - provides formatting functions for printing docstring.AbstractDoc generated python documentation objects.%doc>
+<%!
+import docstring
+import sys, re
+
+def whitespace(docstring):
+ if not docstring:
+ return ''
+
+ # Convert tabs to spaces (following the normal Python rules)
+ # and split into a list of lines:
+ lines = docstring.expandtabs().splitlines()
+ # Determine minimum indentation (first line doesn't count):
+ indent = sys.maxint
+ for line in lines[1:]:
+ stripped = line.lstrip()
+ if stripped:
+ indent = min(indent, len(line) - len(stripped))
+ # Remove indentation (first line is special):
+ trimmed = [lines[0].strip()]
+ if indent < sys.maxint:
+ for line in lines[1:]:
+ trimmed.append(line[indent:].rstrip())
+ # Strip off trailing and leading blank lines:
+ while trimmed and not trimmed[-1]:
+ trimmed.pop()
+ while trimmed and not trimmed[0]:
+ trimmed.pop(0)
+ # Return a single string:
+ return '\n'.join(trimmed)
+
+def convquotes(text):
+ return re.sub(r'``(.*?)``', lambda m: "%s" % m.group(1), text)
+
+%>
+<%namespace name="formatting" file="formatting.html"/>
+<%namespace name="nav" file="nav.html"/>
+
+<%def name="obj_doc(obj, toc, extension, paged)">
+ <%
+ if obj.isclass:
+ links = []
+ for elem in obj.inherits:
+ if isinstance(elem, docstring.ObjectDoc):
+ links.append(capture(nav.toclink, toc=toc, path=elem.toc_path, extension=extension, description=elem.name, paged=paged))
+ else:
+ links.append(str(elem))
+ htmldescription = "class " + obj.classname + "(%s)" % (','.join(links))
+ else:
+ htmldescription = obj.description
+
+ %>
+
+ <%call expr="formatting.section(toc=toc, path=obj.toc_path, description=htmldescription, paged=paged, extension=extension)">
+ % if obj.doc:
+
${obj.doc or '' |whitespace, h,convquotes}
+ % endif
+
+ % if not obj.isclass and obj.functions:
+
+ <%call expr="formatting.section(toc=toc, path=obj.mod_path, paged=paged, extension=extension)">
+ % for func in obj.functions:
+ ${function_doc(func=func,toc=toc)}
+ % endfor
+ %call>
+
+ % else:
+
+ % if obj.functions:
+ % for func in obj.functions:
+ % if isinstance(func, docstring.FunctionDoc):
+ ${function_doc(func=func, toc=toc)}
+ % elif isinstance(func, docstring.PropertyDoc):
+ ${property_doc(prop=func)}
+ % endif
+ % endfor
+ % endif
+ % endif
+
+ % if obj.classes:
+ % for class_ in obj.classes:
+ ${obj_doc(obj=class_, toc=toc, extension=extension, paged=paged)}
+ % endfor
+ % endif
+ %call>
+%def>
+
+<%def name="function_doc(func, toc)">
+
+%def>
+
diff --git a/doc/docs.css b/doc/docs.css
index 25fa1624b2..59f0ef4d7b 100644
--- a/doc/docs.css
+++ b/doc/docs.css
@@ -1,84 +1,19 @@
/* documentation section styles */
-.doccontainer {
-}
-
-.panecontainer {
-}
-
-.sidebar {
- background-color: #fbfbee;
- border: solid 1px #ccc;
- padding: 5px 5px 5px 5px;
- margin: 0px 5px 5px 0px;
- width:120px;
- float:left;
-}
-
-
-.sectionnavblock {
-}
-
-.sectionnav {
- background-color: #fbfbee;
- border: solid 1px #ccc;
- padding: 10px 10px 10px 10px;
- margin: 35px 0px 15px 5px;
- float:right;
-}
-
+#topanchor {position:absolute;left:0px;top:0px;width:0px;height:0px;}
+#pagecontrol {float:right;}
.topnav {
background-color: #fbfbee;
border: solid 1px #ccc;
padding:10px 10px 0px 10px;
- margin:0px 0px 10px 0px;
-}
-
-.tipbox {
- background-color: #fbfbee;
- border:1px solid;
- padding:10px;
- margin: 5px;
-}
-
-.multipage {
- float:right;
-}
-
-/* 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: normal 20px/24px arial,helvetica,sans-serif;
- margin: 0px 0px 0px 0px;
- padding:0px 0px 15px 0px;
-}
-
-.topnavitems {
- margin: 0px 0px 0px 40px;
+ margin:10px 0px 10px 0px;
}
.prevnext {
padding: 5px 0px 0px 0px;
}
-
.codetitle {
font-family: verdana, sans-serif;
font-size: 12px;
@@ -93,24 +28,11 @@
color: #960;
}
-
-.content {
- border: solid 1px #ccc;
- padding: 0px 10px 20px 0px;
-}
-
-.sectioncontent {
- border: solid 1px #fff;
- padding: 0px 10px 20px 0px;
- line-height: 1.5em;
+h1, h2, h3 {
+ font-family:arial,helvetica,sans-serif;
}
-.onepagecontent {
- border: solid 1px #ccc;
- margin: 0px 0px 0px 0px;
-}
-
-h1, .docheadertext {
+h1 {
font: normal 20px/22px arial,helvetica,sans-serif;
color: #222;
padding:0px;
@@ -118,82 +40,65 @@ h1, .docheadertext {
}
h2 {
- font-size:16px;
- font-weight:bold;
- display:inline;
- padding:0px;
+ font-family:arial,helvetica,sans-serif;
+ font-size:20px;
+ font-weight:normal;
+ line-height:24px;
margin:0px;
}
-.docheader {
- margin: 0px 0px 10px 0px;
- line-height: 1.2em;
-}
-
-.docheaderversion {
- margin: 0.8em 0;
-}
-
-.subsection {
- /* this style is dynamically modified by the indentation */
- margin:15px 0px 0px 0px;
- clear:right;
-}
-
-.section {
- padding: 20px 0px 0px 0px;
+h3 {
+ font-family: arial, sans-serif;
+ font-size:16px;
+ font-weight:bold;
}
-h3, .sectionheadertext {
- font-family: arial, sans-serif;
+.topnav h3 {
font-weight: bold;
font-size: 16px;
+ margin:0px;
+ display:inline;
+ font-family:verdana,sans-serif;
}
-.sectiontext {
- font-size: 12px;
- margin: 5px 0px 0px 0px;
-}
-
-.maintoc {
- /*background-color: #fbfbee;*/
- background-color: #fbfbee;
- border: solid 1px #ccc;
- padding: 10px 10px 10px 10px;
- margin: 0px 0px 10px 0px;
+.topnav h2 {
+ margin:26px 4px 0px 5px;
}
-.toclinkcontainer {
- padding:0px 0px 0px 8px;
- /*border:1px solid;*/
+.section {
+ line-height: 1.5em;
+ padding:8px 10px 20px 10px;
+ margin:10px 0px 0px;
}
-.tocsection {
- padding:2px 2px 2px 8px;
+.subsection {
+ margin:0px 0px 0px 20px;
+ line-height: 1.5em;
}
-.toc_list {
- padding:0px;
- margin:0px;
-}
-.toc_list li {
+.topnav li {
font-size:12px;
list-style-type:none;
padding:0px 0px 3px 8px;
margin:0px;
}
-.small_toc_list {
+.topnav ul ul {
padding:0px 0px 0px 8px;
}
-.small_toc_list li {
+.topnav ul ul li {
font-size: 11px;
- list-style-type:none;
}
-
+.bottomnav {
+ background-color:#FBFBEE;
+ border:1px solid #CCCCCC;
+ float:right;
+ margin:0px 0px 15px 5px;
+ padding:10px;
+}
.toclink {
font-weight: bold;
@@ -254,7 +159,6 @@ h3, .sectionheadertext {
/*clear:right;*/
}
-
.codepoplink,
#docs a.codepoplink
{
@@ -278,6 +182,3 @@ h3, .sectionheadertext {
background-color: #900;
}
-.popup {
- margin:10px;
-}
diff --git a/lib/sqlalchemy/engine/__init__.py b/lib/sqlalchemy/engine/__init__.py
index c3651c88b9..e72c375537 100644
--- a/lib/sqlalchemy/engine/__init__.py
+++ b/lib/sqlalchemy/engine/__init__.py
@@ -41,44 +41,30 @@ default_strategy = 'plain'
def create_engine(*args, **kwargs):
"""Create a new Engine instance.
- Using the given strategy name, locates that strategy and invokes
- its create() method to produce the Engine. The strategies
- themselves are instances of EngineStrategy, and the built in ones
- are present in the sqlalchemy.engine.strategies module. Current
- implementations include *plain* and *threadlocal*. The default
- used by this function is *plain*.
-
- *plain* provides support for a Connection object which can be used
- to execute SQL queries with a specific underlying DBAPI connection.
-
- *threadlocal* is similar to *plain* except that it adds support
- for a thread-local connection and transaction context, which
- allows a group of engine operations to participate using the same
- connection and transaction without the need for explicit passing
- of a Connection object.
-
The standard method of specifying the engine is via URL as the
first positional argument, to indicate the appropriate database
dialect and connection arguments, with additional keyword
arguments sent as options to the dialect and resulting Engine.
- The URL is in the form ``://opt1=val1&opt2=val2``, where
- ```` is a name such as *mysql*, *oracle*, *postgres*, and the
- options indicate username, password, database, etc. Supported
- keynames include `username`, `user`, `password`, `pw`, `db`,
- `database`, `host`, `filename`.
+ The URL is in the form
+ ``dialect://user:password@host/dbname[?key=value..]``, where
+ ``dialect`` is a name such as ``mysql``, ``oracle``, ``postgres``,
+ etc.
`**kwargs` represents options to be sent to the Engine itself as
well as the components of the Engine, including the Dialect, the
ConnectionProvider, and the Pool. A list of common options is as
follows:
+ poolclass
+ a subclass of ``sqlalchemy.pool.Pool`` which will be used to
+ instantiate a connection pool.
+
pool
- Defaults to None: an instance of ``sqlalchemy.pool.DBProxy`` or
+ an instance of ``sqlalchemy.pool.DBProxy`` or
``sqlalchemy.pool.Pool`` to be used as the underlying source for
connections (DBProxy/Pool is described in the previous
- section). If None, a default DBProxy will be created using the
- engine's own database module with the given arguments.
+ section). This argument supercedes "poolclass".
echo
Defaults to False: if True, the Engine will log all statements
@@ -102,21 +88,25 @@ def create_engine(*args, **kwargs):
to all str types.
module
- Defaults to None: used by Oracle and Postgres, this is a
+ Defaults to None: this is a
reference to a DBAPI2 module to be used instead of the engine's
default module. For Postgres, the default is psycopg2, or
psycopg1 if 2 cannot be found. For Oracle, its cx_Oracle. For
mysql, MySQLdb.
- use_ansi
- Defaults to True: used only by Oracle; when False, the Oracle
- driver attempts to support a particular *quirk* of some Oracle
- databases, that the ``LEFT OUTER JOIN`` SQL syntax is not
- supported, and the *Oracle join* syntax of using
- ``(+)=`` must be used in order to achieve a
- ``LEFT OUTER JOIN``. Its advised that the Oracle database be
- configured to have full ANSI support instead of using this
- feature.
+ strategy
+ allows alternate Engine implementations to take effect.
+ Current implementations include ``plain`` and ``threadlocal``.
+ The default used by this function is ``plain``.
+
+ ``plain`` provides support for a Connection object which can be used
+ to execute SQL queries with a specific underlying DBAPI connection.
+
+ ``threadlocal`` is similar to ``plain`` except that it adds support
+ for a thread-local connection and transaction context, which
+ allows a group of engine operations to participate using the same
+ underlying connection and transaction without the need for explicitly
+ passing a single Connection.
"""
strategy = kwargs.pop('strategy', default_strategy)
--
2.47.2