summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-01-11 10:12:12 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2017-01-13 10:57:41 -0500
commitfa6dd376bb24845724287d980a98ea50eb1cfab1 (patch)
tree91e536c76f4b76b8997b02f5cd5a41de29dc90ef /lib/sqlalchemy/sql/elements.py
parentc703b9ce89483b6f44b97d1fbf56f8df8b14305a (diff)
downloadsqlalchemy-fa6dd376bb24845724287d980a98ea50eb1cfab1.tar.gz
Support python3.6
Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 93ae0c638..a450efaf0 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -105,7 +105,7 @@ def between(expr, lower_bound, upper_bound, symmetric=False):
def literal(value, type_=None):
- """Return a literal clause, bound to a bind parameter.
+ r"""Return a literal clause, bound to a bind parameter.
Literal clauses are created automatically when non-
:class:`.ClauseElement` objects (such as strings, ints, dates, etc.) are
@@ -305,7 +305,7 @@ class ClauseElement(Visitable):
return cloned_traverse(self, {}, {'bindparam': visit_bindparam})
def compare(self, other, **kw):
- """Compare this ClauseElement to the given ClauseElement.
+ r"""Compare this ClauseElement to the given ClauseElement.
Subclasses should override the default behavior, which is a
straight identity comparison.
@@ -331,7 +331,7 @@ class ClauseElement(Visitable):
pass
def get_children(self, **kwargs):
- """Return immediate child elements of this :class:`.ClauseElement`.
+ r"""Return immediate child elements of this :class:`.ClauseElement`.
This is used for visit traversal.
@@ -835,14 +835,14 @@ class ColumnElement(operators.ColumnOperators, ClauseElement):
class BindParameter(ColumnElement):
- """Represent a "bound expression".
+ r"""Represent a "bound expression".
:class:`.BindParameter` is invoked explicitly using the
:func:`.bindparam` function, as in::
from sqlalchemy import bindparam
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
where(users_table.c.name == bindparam('username'))
Detailed discussion of how :class:`.BindParameter` is used is
@@ -864,7 +864,7 @@ class BindParameter(ColumnElement):
isoutparam=False,
_compared_to_operator=None,
_compared_to_type=None):
- """Produce a "bound expression".
+ r"""Produce a "bound expression".
The return value is an instance of :class:`.BindParameter`; this
is a :class:`.ColumnElement` subclass which represents a so-called
@@ -888,7 +888,7 @@ class BindParameter(ColumnElement):
from sqlalchemy import bindparam
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
where(users_table.c.name == bindparam('username'))
The above statement, when rendered, will produce SQL similar to::
@@ -1240,7 +1240,7 @@ class TextClause(Executable, ClauseElement):
@classmethod
def _create_text(self, text, bind=None, bindparams=None,
typemap=None, autocommit=None):
- """Construct a new :class:`.TextClause` clause, representing
+ r"""Construct a new :class:`.TextClause` clause, representing
a textual SQL string directly.
E.g.::
@@ -1268,7 +1268,7 @@ class TextClause(Executable, ClauseElement):
For SQL statements where a colon is required verbatim, as within
an inline string, use a backslash to escape::
- t = text("SELECT * FROM users WHERE name='\\:username'")
+ t = text("SELECT * FROM users WHERE name='\:username'")
The :class:`.TextClause` construct includes methods which can
provide information about the bound parameters as well as the column
@@ -1278,8 +1278,8 @@ class TextClause(Executable, ClauseElement):
parameter detail, and :meth:`.TextClause.columns` method allows
specification of return columns including names and types::
- t = text("SELECT * FROM users WHERE id=:user_id").\\
- bindparams(user_id=7).\\
+ t = text("SELECT * FROM users WHERE id=:user_id").\
+ bindparams(user_id=7).\
columns(id=Integer, name=String)
for id, name in connection.execute(t):
@@ -1301,7 +1301,7 @@ class TextClause(Executable, ClauseElement):
can be set explicitly so using the
:paramref:`.Connection.execution_options.autocommit` option::
- t = text("EXEC my_procedural_thing()").\\
+ t = text("EXEC my_procedural_thing()").\
execution_options(autocommit=True)
Note that SQLAlchemy's usual "autocommit" behavior applies to
@@ -1333,7 +1333,7 @@ class TextClause(Executable, ClauseElement):
Is equivalent to::
- stmt = text("SELECT * FROM table WHERE id=:id").\\
+ stmt = text("SELECT * FROM table WHERE id=:id").\
bindparams(bindparam('id', value=5, type_=Integer))
.. deprecated:: 0.9.0 the :meth:`.TextClause.bindparams` method
@@ -1495,7 +1495,7 @@ class TextClause(Executable, ClauseElement):
stmt = text("SELECT id, name FROM some_table")
stmt = stmt.columns(column('id'), column('name')).alias('st')
- stmt = select([mytable]).\\
+ stmt = select([mytable]).\
select_from(
mytable.join(stmt, mytable.c.name == stmt.c.name)
).where(stmt.c.id > 5)
@@ -1921,8 +1921,8 @@ class BooleanClauseList(ClauseList, ColumnElement):
times against a statement, which will have the effect of each
clause being combined using :func:`.and_`::
- stmt = select([users_table]).\\
- where(users_table.c.name == 'wendy').\\
+ stmt = select([users_table]).\
+ where(users_table.c.name == 'wendy').\
where(users_table.c.enrolled == True)
.. seealso::
@@ -2034,7 +2034,7 @@ class Case(ColumnElement):
from sqlalchemy import case
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
where(
case(
[
@@ -2056,7 +2056,7 @@ class Case(ColumnElement):
__visit_name__ = 'case'
def __init__(self, whens, value=None, else_=None):
- """Produce a ``CASE`` expression.
+ r"""Produce a ``CASE`` expression.
The ``CASE`` construct in SQL is a conditional object that
acts somewhat analogously to an "if/then" construct in other
@@ -2067,7 +2067,7 @@ class Case(ColumnElement):
from sqlalchemy import case
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
where(
case(
[
@@ -2096,7 +2096,7 @@ class Case(ColumnElement):
compared against keyed to result expressions. The statement below is
equivalent to the preceding statement::
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
where(
case(
{"wendy": "W", "jack": "J"},
@@ -2233,7 +2233,7 @@ class Case(ColumnElement):
def literal_column(text, type_=None):
- """Produce a :class:`.ColumnClause` object that has the
+ r"""Produce a :class:`.ColumnClause` object that has the
:paramref:`.column.is_literal` flag set to True.
:func:`.literal_column` is similar to :func:`.column`, except that
@@ -2555,7 +2555,7 @@ class UnaryExpression(ColumnElement):
from sqlalchemy import desc, nullsfirst
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
order_by(nullsfirst(desc(users_table.c.name)))
The SQL expression from the above would resemble::
@@ -2598,7 +2598,7 @@ class UnaryExpression(ColumnElement):
from sqlalchemy import desc, nullslast
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
order_by(nullslast(desc(users_table.c.name)))
The SQL expression from the above would resemble::
@@ -2610,7 +2610,7 @@ class UnaryExpression(ColumnElement):
:meth:`.ColumnElement.nullslast`, rather than as its standalone
function version, as in::
- stmt = select([users_table]).\\
+ stmt = select([users_table]).\
order_by(users_table.c.name.desc().nullslast())
.. seealso::
@@ -3292,7 +3292,7 @@ class WithinGroup(ColumnElement):
order_by = None
def __init__(self, element, *order_by):
- """Produce a :class:`.WithinGroup` object against a function.
+ r"""Produce a :class:`.WithinGroup` object against a function.
Used against so-called "ordered set aggregate" and "hypothetical
set aggregate" functions, including :class:`.percentile_cont`,