From: Mike Bayer Date: Sun, 5 Sep 2010 20:06:39 +0000 (-0400) Subject: fixup X-Git-Tag: rel_0_6_4~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=914ae5bcd4dbac844d26c70eeeb2f8bffd03c20d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixup --- diff --git a/doc/build/core/expression_api.rst b/doc/build/core/expression_api.rst index 8431fd6c8f..c01f84c2cb 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 29db3d5d6c..61fb2fb29e 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 4a34ef1c67..def889e6d9 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'):