diff options
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 26 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/functions.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index a99c6ca35..df690c383 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -299,9 +299,9 @@ class ClauseElement( elements replaced with values taken from the given dictionary:: >>> clause = column('x') + bindparam('foo') - >>> print clause.compile().params + >>> print(clause.compile().params) {'foo':None} - >>> print clause.params({'foo':7}).compile().params + >>> print(clause.params({'foo':7}).compile().params) {'foo':7} """ @@ -466,7 +466,7 @@ class ClauseElement( s = select([t]).where(t.c.x == 5) - print s.compile(compile_kwargs={"literal_binds": True}) + print(s.compile(compile_kwargs={"literal_binds": True})) .. versionadded:: 0.9.0 @@ -627,7 +627,7 @@ class ColumnElement( >>> from sqlalchemy.sql import column >>> column('a') + column('b') <sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0> - >>> print column('a') + column('b') + >>> print(column('a') + column('b')) a + b .. seealso:: @@ -1947,23 +1947,23 @@ class False_(roles.ConstExprRole, ColumnElement): E.g.:: >>> from sqlalchemy import false - >>> print select([t.c.x]).where(false()) + >>> print(select([t.c.x]).where(false())) SELECT x FROM t WHERE false A backend which does not support true/false constants will render as an expression against 1 or 0:: - >>> print select([t.c.x]).where(false()) + >>> print(select([t.c.x]).where(false())) SELECT x FROM t WHERE 0 = 1 The :func:`.true` and :func:`.false` constants also feature "short circuit" operation within an :func:`.and_` or :func:`.or_` conjunction:: - >>> print select([t.c.x]).where(or_(t.c.x > 5, true())) + >>> print(select([t.c.x]).where(or_(t.c.x > 5, true()))) SELECT x FROM t WHERE true - >>> print select([t.c.x]).where(and_(t.c.x > 5, false())) + >>> print(select([t.c.x]).where(and_(t.c.x > 5, false()))) SELECT x FROM t WHERE false .. versionchanged:: 0.9 :func:`.true` and :func:`.false` feature @@ -2012,23 +2012,23 @@ class True_(roles.ConstExprRole, ColumnElement): E.g.:: >>> from sqlalchemy import true - >>> print select([t.c.x]).where(true()) + >>> print(select([t.c.x]).where(true())) SELECT x FROM t WHERE true A backend which does not support true/false constants will render as an expression against 1 or 0:: - >>> print select([t.c.x]).where(true()) + >>> print(select([t.c.x]).where(true())) SELECT x FROM t WHERE 1 = 1 The :func:`.true` and :func:`.false` constants also feature "short circuit" operation within an :func:`.and_` or :func:`.or_` conjunction:: - >>> print select([t.c.x]).where(or_(t.c.x > 5, true())) + >>> print(select([t.c.x]).where(or_(t.c.x > 5, true()))) SELECT x FROM t WHERE true - >>> print select([t.c.x]).where(and_(t.c.x > 5, false())) + >>> print(select([t.c.x]).where(and_(t.c.x > 5, false()))) SELECT x FROM t WHERE false .. versionchanged:: 0.9 :func:`.true` and :func:`.false` feature @@ -3315,7 +3315,7 @@ class BinaryExpression(ColumnElement): >>> from sqlalchemy.sql import column >>> column('a') + column('b') <sqlalchemy.sql.expression.BinaryExpression object at 0x101029dd0> - >>> print column('a') + column('b') + >>> print(column('a') + column('b')) a + b """ diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 137b1605a..c1720b4c3 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -674,7 +674,7 @@ class GenericFunction(util.with_metaclass(_GenericMeta, Function)): class as_utc(GenericFunction): type = DateTime - print select([func.as_utc()]) + print(select([func.as_utc()])) User-defined generic functions can be organized into packages by specifying the "package" attribute when defining @@ -691,7 +691,7 @@ class GenericFunction(util.with_metaclass(_GenericMeta, Function)): The above function would be available from :data:`.func` using the package name ``time``:: - print select([func.time.as_utc()]) + print(select([func.time.as_utc()])) A final option is to allow the function to be accessed from one name in :data:`.func` but to render as a different name. diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index b11e315ea..b8d88e160 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -3913,10 +3913,10 @@ class Select( >>> table1 = table('t1', column('a'), column('b')) >>> table2 = table('t2', column('a'), column('b')) >>> s1 = select([table1.c.a, table2.c.b]) - >>> print s1 + >>> print(s1) SELECT t1.a, t2.b FROM t1, t2 >>> s2 = s1.with_only_columns([table2.c.b]) - >>> print s2 + >>> print(s2) SELECT t2.b FROM t1 The preferred way to maintain a specific FROM clause @@ -3928,7 +3928,7 @@ class Select( ... select_from(table1.join(table2, ... table1.c.a==table2.c.a)) >>> s2 = s1.with_only_columns([table2.c.b]) - >>> print s2 + >>> print(s2) SELECT t2.b FROM t1 JOIN t2 ON t1.a=t2.a Care should also be taken to use the correct diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 52b9fa1a9..22c80cc91 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -177,7 +177,7 @@ class String(Concatenable, TypeEngine): E.g.:: >>> from sqlalchemy import cast, select, String - >>> print select([cast('some string', String(collation='utf8'))]) + >>> print(select([cast('some string', String(collation='utf8'))])) SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1 :param convert_unicode: When set to ``True``, the |