summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-09-05 16:06:39 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-09-05 16:06:39 -0400
commit914ae5bcd4dbac844d26c70eeeb2f8bffd03c20d (patch)
treed15c31991aca9719ab09f8734ca41284e8821bdb
parent703ce7f1791c1143eb983c38e3bd627984ea1953 (diff)
downloadsqlalchemy-914ae5bcd4dbac844d26c70eeeb2f8bffd03c20d.tar.gz
fixup
-rw-r--r--doc/build/core/expression_api.rst25
-rw-r--r--doc/build/orm/session.rst6
-rw-r--r--lib/sqlalchemy/engine/reflection.py14
3 files changed, 32 insertions, 13 deletions
diff --git a/doc/build/core/expression_api.rst b/doc/build/core/expression_api.rst
index 8431fd6c8..c01f84c2c 100644
--- a/doc/build/core/expression_api.rst
+++ b/doc/build/core/expression_api.rst
@@ -52,7 +52,10 @@ The expression package uses functions to construct SQL expressions. The return
>>> print func.count(1)
count(:param_1)
- Any name can be given to `func`. If the function name is unknown to SQLAlchemy, it will be rendered exactly as is. For common SQL functions which SQLAlchemy is aware of, the name may be interpreted as a *generic function* which will be compiled appropriately to the target database::
+ Any name can be given to `func`. If the function name is unknown to
+ SQLAlchemy, it will be rendered exactly as is. For common SQL functions
+ which SQLAlchemy is aware of, the name may be interpreted as a *generic
+ function* which will be compiled appropriately to the target database::
>>> print func.current_timestamp()
CURRENT_TIMESTAMP
@@ -62,13 +65,19 @@ The expression package uses functions to construct SQL expressions. The return
>>> print func.stats.yield_curve(5, 10)
stats.yield_curve(:yield_curve_1, :yield_curve_2)
- SQLAlchemy can be made aware of the return type of functions to enable type-specific lexical and result-based behavior. For example, to ensure that a string-based function returns a Unicode value and is similarly treated as a string in expressions, specify :class:`~sqlalchemy.types.Unicode` as the type:
+ SQLAlchemy can be made aware of the return type of functions to enable
+ type-specific lexical and result-based behavior. For example, to ensure
+ that a string-based function returns a Unicode value and is similarly
+ treated as a string in expressions, specify
+ :class:`~sqlalchemy.types.Unicode` as the type:
>>> print func.my_string(u'hi', type_=Unicode) + ' ' + \
... func.my_string(u'there', type_=Unicode)
my_string(:my_string_1) || :my_string_2 || my_string(:my_string_3)
- Functions which are interpreted as "generic" functions know how to calculate their return type automatically. For a listing of known generic functions, see :ref:`generic_functions`.
+ Functions which are interpreted as "generic" functions know how to
+ calculate their return type automatically. For a listing of known generic
+ functions, see :ref:`generic_functions`.
.. autofunction:: insert
@@ -204,10 +213,18 @@ Classes
Generic Functions
-----------------
-SQL functions which are known to SQLAlchemy with regards to database-specific rendering, return types and argument behavior. Generic functions are invoked like all SQL functions, using the :attr:`func` attribute::
+SQL functions which are known to SQLAlchemy with regards to database-specific
+rendering, return types and argument behavior. Generic functions are invoked
+like all SQL functions, using the :attr:`func` attribute::
select([func.count()]).select_from(sometable)
+Note that any name not known to :attr:`func` generates the function name as is
+- there is no restriction on what SQL functions can be called, known or
+unknown to SQLAlchemy, built-in or user defined. The section here only
+describes those functions where SQLAlchemy already knows what argument and
+return types are in use.
+
.. automodule:: sqlalchemy.sql.functions
:members:
:undoc-members:
diff --git a/doc/build/orm/session.rst b/doc/build/orm/session.rst
index 29db3d5d6..61fb2fb29 100644
--- a/doc/build/orm/session.rst
+++ b/doc/build/orm/session.rst
@@ -811,10 +811,12 @@ transaction::
item1.foo = 'bar'
item2.bar = 'foo'
- # commit- will immediately go into a new transaction afterwards
+ # commit- will immediately go into
+ # a new transaction on next use.
session.commit()
except:
- # rollback - will immediately go into a new transaction afterwards.
+ # rollback - will immediately go into
+ # a new transaction on next use.
session.rollback()
A session which is configured with ``autocommit=True`` may be placed into a
diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py
index 4a34ef1c6..def889e6d 100644
--- a/lib/sqlalchemy/engine/reflection.py
+++ b/lib/sqlalchemy/engine/reflection.py
@@ -50,27 +50,27 @@ class Inspector(object):
consistent interface as well as caching support for previously
fetched metadata.
- The preferred method to construct an :class:`Inspector` is via the
+ The preferred method to construct an :class:`.Inspector` is via the
:meth:`Inspector.from_engine` method. I.e.::
engine = create_engine('...')
insp = Inspector.from_engine(engine)
Where above, the :class:`~sqlalchemy.engine.base.Dialect` may opt
- to return an :class:`Inspector` subclass that provides additional
+ to return an :class:`.Inspector` subclass that provides additional
methods specific to the dialect's target database.
"""
def __init__(self, bind):
- """Initialize a new :class:`Inspector`.
+ """Initialize a new :class:`.Inspector`.
:param bind: a :class:`~sqlalchemy.engine.base.Connectable`,
which is typically an instance of
:class:`~sqlalchemy.engine.base.Engine` or
:class:`~sqlalchemy.engine.base.Connection`.
- For a dialect-specific instance of :class:`Inspector`, see
+ For a dialect-specific instance of :class:`.Inspector`, see
:meth:`Inspector.from_engine`
"""
@@ -98,12 +98,12 @@ class Inspector(object):
:class:`~sqlalchemy.engine.base.Engine` or
:class:`~sqlalchemy.engine.base.Connection`.
- This method differs from direct a direct constructor call of :class:`Inspector`
+ This method differs from direct a direct constructor call of :class:`.Inspector`
in that the :class:`~sqlalchemy.engine.base.Dialect` is given a chance to provide
- a dialect-specific :class:`Inspector` instance, which may provide additional
+ a dialect-specific :class:`.Inspector` instance, which may provide additional
methods.
- See the example at :class:`Inspector`.
+ See the example at :class:`.Inspector`.
"""
if hasattr(bind.dialect, 'inspector'):