[Python-modules-commits] [sqlalchemy] 01/04: Import sqlalchemy_1.0.13+ds1.orig.tar.gz
Piotr Ożarowski
piotr at moszumanska.debian.org
Sun Jun 5 21:04:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
piotr pushed a commit to branch master
in repository sqlalchemy.
commit b5ead0dbb4a6c7d6dd5cc8dd999698017dd2782b
Author: Piotr Ożarowski <piotr at debian.org>
Date: Sun Jun 5 22:53:15 2016 +0200
Import sqlalchemy_1.0.13+ds1.orig.tar.gz
---
PKG-INFO | 2 +-
doc/build/changelog/changelog_06.rst | 2 +-
doc/build/changelog/changelog_07.rst | 4 +-
doc/build/changelog/changelog_10.rst | 148 +++++++++
doc/build/changelog/migration_04.rst | 2 +-
doc/build/changelog/migration_05.rst | 6 +-
doc/build/changelog/migration_06.rst | 14 +-
doc/build/changelog/migration_07.rst | 4 +-
doc/build/changelog/migration_08.rst | 14 +-
doc/build/changelog/migration_09.rst | 32 +-
doc/build/changelog/migration_10.rst | 14 +-
doc/build/conf.py | 4 +-
doc/build/core/connections.rst | 6 +-
doc/build/core/custom_types.rst | 16 +-
doc/build/core/event.rst | 4 +-
doc/build/core/metadata.rst | 8 +-
doc/build/core/pooling.rst | 10 +-
doc/build/core/reflection.rst | 2 +-
doc/build/faq/metadata_schema.rst | 8 +-
doc/build/faq/ormconfiguration.rst | 3 +-
doc/build/faq/performance.rst | 2 +-
doc/build/faq/sessions.rst | 6 +-
doc/build/glossary.rst | 8 +-
doc/build/orm/backref.rst | 6 +-
doc/build/orm/basic_relationships.rst | 4 +-
doc/build/orm/cascades.rst | 4 +-
doc/build/orm/collections.rst | 2 +-
doc/build/orm/composites.rst | 30 +-
doc/build/orm/contextual.rst | 4 +-
doc/build/orm/extensions/declarative/mixins.rst | 2 +-
doc/build/orm/loading_columns.rst | 4 +-
doc/build/orm/mapped_attributes.rst | 4 +-
doc/build/orm/mapped_sql_expr.rst | 2 +-
doc/build/orm/session_state_management.rst | 4 +-
doc/build/orm/session_transaction.rst | 2 +-
doc/build/orm/tutorial.rst | 4 +-
examples/graphs/directed_graph.py | 90 +++---
examples/performance/short_selects.py | 4 +-
lib/sqlalchemy/__init__.py | 2 +-
lib/sqlalchemy/dialects/mssql/base.py | 42 ++-
lib/sqlalchemy/dialects/mssql/pymssql.py | 2 +-
lib/sqlalchemy/dialects/mssql/pyodbc.py | 7 +
lib/sqlalchemy/dialects/mysql/base.py | 30 +-
lib/sqlalchemy/dialects/oracle/cx_oracle.py | 10 +-
lib/sqlalchemy/dialects/postgresql/base.py | 10 +-
lib/sqlalchemy/dialects/postgresql/psycopg2.py | 1 +
lib/sqlalchemy/engine/__init__.py | 2 +-
lib/sqlalchemy/engine/result.py | 33 +-
lib/sqlalchemy/events.py | 4 +-
lib/sqlalchemy/ext/declarative/base.py | 3 +-
lib/sqlalchemy/orm/base.py | 2 +-
lib/sqlalchemy/orm/evaluator.py | 5 +-
lib/sqlalchemy/orm/loading.py | 2 +-
lib/sqlalchemy/orm/mapper.py | 18 +-
lib/sqlalchemy/orm/query.py | 31 +-
lib/sqlalchemy/orm/strategies.py | 20 +-
lib/sqlalchemy/orm/strategy_options.py | 2 +-
lib/sqlalchemy/sql/compiler.py | 14 +-
lib/sqlalchemy/sql/crud.py | 2 +-
lib/sqlalchemy/sql/elements.py | 21 +-
lib/sqlalchemy/sql/functions.py | 26 +-
lib/sqlalchemy/sql/util.py | 10 +
lib/sqlalchemy/testing/plugin/plugin_base.py | 8 +-
lib/sqlalchemy/testing/provision.py | 19 +-
lib/sqlalchemy/util/_collections.py | 6 +-
lib/sqlalchemy/util/compat.py | 2 +
test/base/test_utils.py | 16 +-
test/dialect/mssql/test_compiler.py | 51 +++-
test/engine/test_execute.py | 306 -------------------
test/ext/test_compiler.py | 2 +-
test/orm/inheritance/test_basic.py | 2 +-
test/orm/test_evaluator.py | 38 ++-
test/orm/test_loading.py | 18 +-
test/orm/test_mapper.py | 41 +++
test/orm/test_query.py | 78 ++++-
test/sql/test_compiler.py | 120 +++++---
test/sql/test_insert.py | 66 +++-
test/sql/test_resultset.py | 382 +++++++++++++++++++++++-
test/sql/test_selectable.py | 27 ++
test/sql/test_update.py | 36 ++-
80 files changed, 1367 insertions(+), 635 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index c95fb48..6705ec2 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: SQLAlchemy
-Version: 1.0.12
+Version: 1.0.13
Summary: Database Abstraction Library
Home-page: http://www.sqlalchemy.org
Author: Mike Bayer
diff --git a/doc/build/changelog/changelog_06.rst b/doc/build/changelog/changelog_06.rst
index 67fd0f1..927aae2 100644
--- a/doc/build/changelog/changelog_06.rst
+++ b/doc/build/changelog/changelog_06.rst
@@ -3845,7 +3845,7 @@
:tickets:
For the full set of feature descriptions, see
- http://www.sqlalchemy.org/trac/wiki/06Migration .
+ http://docs.sqlalchemy.org/en/latest/changelog/migration_06.html .
This document is a work in progress.
.. change::
diff --git a/doc/build/changelog/changelog_07.rst b/doc/build/changelog/changelog_07.rst
index e782ba9..fa952f0 100644
--- a/doc/build/changelog/changelog_07.rst
+++ b/doc/build/changelog/changelog_07.rst
@@ -3220,7 +3220,7 @@
This section documents those changes from 0.7b4
to 0.7.0. For an overview of what's new in
SQLAlchemy 0.7, see
- http://www.sqlalchemy.org/trac/wiki/07Migration
+ http://docs.sqlalchemy.org/en/latest/changelog/migration_07.html
.. change::
:tags: orm
@@ -4125,7 +4125,7 @@
Detailed descriptions of each change below are
described at:
- http://www.sqlalchemy.org/trac/wiki/07Migration
+ http://docs.sqlalchemy.org/en/latest/changelog/migration_07.html
.. change::
:tags: general
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst
index 1e10b97..39670b0 100644
--- a/doc/build/changelog/changelog_10.rst
+++ b/doc/build/changelog/changelog_10.rst
@@ -16,6 +16,154 @@
:start-line: 5
.. changelog::
+ :version: 1.0.13
+ :released: May 16, 2016
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 3700
+
+ Fixed bug in "evaluate" strategy of :meth:`.Query.update` and
+ :meth:`.Query.delete` which would fail to accommodate a bound
+ parameter with a "callable" value, as which occurs when filtering
+ by a many-to-one equality expression along a relationship.
+
+ .. change::
+ :tags: bug, postgresql
+ :tickets: 3715
+
+ Added disconnect detection support for the error string
+ "SSL error: decryption failed or bad record mac". Pull
+ request courtesy Iuri de Silvio.
+
+ .. change::
+ :tags: bug, mssql
+ :tickets: 3711
+
+ Fixed bug where by ROW_NUMBER OVER clause applied for OFFSET
+ selects in SQL Server would inappropriately substitute a plain column
+ from the local statement that overlaps with a label name used by
+ the ORDER BY criteria of the statement.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 3710
+
+ Fixed bug whereby the event listeners used for backrefs could
+ be inadvertently applied multiple times, when using a deep class
+ inheritance hierarchy in conjunction with mutiple mapper configuration
+ steps.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 3706
+
+ Fixed bug whereby passing a :func:`.text` construct to the
+ :meth:`.Query.group_by` method would raise an error, instead
+ of intepreting the object as a SQL fragment.
+
+ .. change::
+ :tags: bug, oracle
+ :tickets: 3705
+
+ Fixed a bug in the cx_Oracle connect process that caused a TypeError
+ when the either the user, password or dsn was empty. This prevented
+ external authentication to Oracle databases, and prevented connecting
+ to the default dsn. The connect string oracle:// now logs into the
+ default dsn using the Operating System username, equivalent to
+ connecting using '/' with sqlplus.
+
+ .. change::
+ :tags: bug, oracle
+ :tickets: 3699
+
+ Fixed a bug in the result proxy used mainly by Oracle when binary and
+ other LOB types are in play, such that when query / statement caching
+ were used, the type-level result processors, notably that required by
+ the binary type itself but also any other processor, would become lost
+ after the first run of the statement due to it being removed from the
+ cached result metadata.
+
+ .. change::
+ :tags: bug, examples
+ :tickets: 3698
+
+ Changed the "directed graph" example to no longer consider
+ integer identifiers of nodes as significant; the "higher" / "lower"
+ references now allow mutual edges in both directions.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 3690
+
+ Fixed bug where when using ``case_sensitive=False`` with an
+ :class:`.Engine`, the result set would fail to correctly accomodate
+ for duplicate column names in the result set, causing an error
+ when the statement is executed in 1.0, and preventing the
+ "ambiguous column" exception from functioning in 1.1.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 3682
+
+ Fixed bug where the negation of an EXISTS expression would not
+ be properly typed as boolean in the result, and also would fail to be
+ anonymously aliased in a SELECT list as is the case with a
+ non-negated EXISTS construct.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 3666
+
+ Fixed bug where "unconsumed column names" exception would fail to
+ be raised in the case where :meth:`.Insert.values` were called
+ with a list of parameter mappings, instead of a single mapping
+ of parameters. Pull request courtesy Athena Yao.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 3663
+
+ Anonymous labeling is applied to a :attr:`.func` construct that is
+ passed to :func:`.column_property`, so that if the same attribute
+ is referred to as a column expression twice the names are de-duped,
+ thus avoiding "ambiguous column" errors. Previously, the
+ ``.label(None)`` would need to be applied in order for the name
+ to be de-anonymized.
+
+ .. change::
+ :tags: bug, py3k
+ :tickets: 3660
+
+ Fixed bug in "to_list" conversion where a single bytes object
+ would be turned into a list of individual characters. This would
+ impact among other things using the :meth:`.Query.get` method
+ on a primary key that's a bytes object.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 3658
+
+ Fixed regression appearing in the 1.0 series in ORM loading where the
+ exception raised for an expected column missing would incorrectly
+ be a ``NoneType`` error, rather than the expected
+ :class:`.NoSuchColumnError`.
+
+ .. change::
+ :tags: bug, mssql, oracle
+ :tickets: 3657
+
+ Fixed regression appearing in the 1.0 series which would cause the Oracle
+ and SQL Server dialects to incorrectly account for result set columns
+ when these dialects would wrap a SELECT in a subquery in order to
+ provide LIMIT/OFFSET behavior, and the original SELECT statement
+ referred to the same column multiple times, such as a column and
+ a label of that same column. This issue is related
+ to :ticket:`3658` in that when the error occurred, it would also
+ cause a ``NoneType`` error, rather than reporting that it couldn't
+ locate a column.
+
+.. changelog::
:version: 1.0.12
:released: February 15, 2016
diff --git a/doc/build/changelog/migration_04.rst b/doc/build/changelog/migration_04.rst
index 068b002..9a3f7d2 100644
--- a/doc/build/changelog/migration_04.rst
+++ b/doc/build/changelog/migration_04.rst
@@ -412,7 +412,7 @@ flush before each query.
foo.bars.append(Bar(name='lala'))
for bar in foo.bars.filter(Bar.name=='lala'):
- print bar
+ print(bar)
session.commit()
diff --git a/doc/build/changelog/migration_05.rst b/doc/build/changelog/migration_05.rst
index 01ceef1..3a6bb26 100644
--- a/doc/build/changelog/migration_05.rst
+++ b/doc/build/changelog/migration_05.rst
@@ -72,7 +72,7 @@ Object Relational Mapping
::
for row in session.query(User.name, func.count(Address.id).label('numaddresses')).join(Address).group_by(User.name):
- print "name", row.name, "number", row.numaddresses
+ print("name", row.name, "number", row.numaddresses)
``Query`` has a ``statement`` accessor, as well as a
``subquery()`` method which allow ``Query`` to be used to
@@ -144,7 +144,7 @@ Object Relational Mapping
::
for col in table.c:
- print col
+ print(col)
Work with a specific column:
@@ -606,7 +606,7 @@ Removed
from sqlalchemy.orm import aliased
address_alias = aliased(Address)
- print session.query(User, address_alias).join((address_alias, User.addresses)).all()
+ print(session.query(User, address_alias).join((address_alias, User.addresses)).all())
* ``sqlalchemy.orm.Mapper``
diff --git a/doc/build/changelog/migration_06.rst b/doc/build/changelog/migration_06.rst
index 21eba3d..1eead6d 100644
--- a/doc/build/changelog/migration_06.rst
+++ b/doc/build/changelog/migration_06.rst
@@ -180,7 +180,7 @@ But what happens if we say this?
::
>>> if column('foo') == 5:
- ... print "yes"
+ ... print("yes")
...
In previous versions of SQLAlchemy, the returned
@@ -205,7 +205,7 @@ That means code such as the following:
::
if expression:
- print "the expression is:", expression
+ print("the expression is:", expression)
Would not evaluate if ``expression`` was a binary clause.
Since the above pattern should never be used, the base
@@ -227,7 +227,7 @@ Code that wants to check for the presence of a
::
if expression is not None:
- print "the expression is:", expression
+ print("the expression is:", expression)
Keep in mind, **this applies to Table and Column objects
too**.
@@ -415,7 +415,7 @@ expression object:
create = CreateTable(mytable)
# dumps the CREATE TABLE as a string
- print create
+ print(create)
# executes the CREATE TABLE statement
engine.execute(create)
@@ -568,7 +568,7 @@ To use an inspector:
from sqlalchemy.engine.reflection import Inspector
insp = Inspector.from_engine(my_engine)
- print insp.get_schema_names()
+ print(insp.get_schema_names())
the ``from_engine()`` method will in some cases provide a
backend-specific inspector with additional capabilities,
@@ -581,7 +581,7 @@ such as that of Postgresql which provides a
my_engine = create_engine('postgresql://...')
pg_insp = Inspector.from_engine(my_engine)
- print pg_insp.get_table_oid('my_table')
+ print(pg_insp.get_table_oid('my_table'))
RETURNING Support
=================
@@ -603,7 +603,7 @@ columns will be returned as a regular result set:
table.insert().values(data='some data').returning(table.c.id, table.c.timestamp)
)
row = result.first()
- print "ID:", row['id'], "Timestamp:", row['timestamp']
+ print("ID:", row['id'], "Timestamp:", row['timestamp'])
The implementation of RETURNING across the four supported
backends varies wildly, in the case of Oracle requiring an
diff --git a/doc/build/changelog/migration_07.rst b/doc/build/changelog/migration_07.rst
index 207397f..a60151d 100644
--- a/doc/build/changelog/migration_07.rst
+++ b/doc/build/changelog/migration_07.rst
@@ -398,7 +398,7 @@ tutorial:
label('avg')
])
- print s
+ print(s)
SQL:
@@ -997,7 +997,7 @@ same manner as that of 0.5 and 0.6:
::
- print s.query(Parent).with_polymorphic([Child]).filter(Child.id > 7)
+ print(s.query(Parent).with_polymorphic([Child]).filter(Child.id > 7))
Which on both 0.6 and 0.7 renders:
diff --git a/doc/build/changelog/migration_08.rst b/doc/build/changelog/migration_08.rst
index fd153a9..9e94de5 100644
--- a/doc/build/changelog/migration_08.rst
+++ b/doc/build/changelog/migration_08.rst
@@ -282,7 +282,7 @@ A walkthrough of some key capabilities follows::
<Mapper at 0x101521950; User>
>>> # an expression
- >>> print b.expression
+ >>> print(b.expression)
"user".id = address.user_id
>>> # inspect works on instances
@@ -432,7 +432,7 @@ with a declarative base class::
@event.listens_for("load", Base, propagate=True)
def on_load(target, context):
- print "New instance loaded:", target
+ print("New instance loaded:", target)
# on_load() will be applied to SomeClass
class SomeClass(Base):
@@ -665,7 +665,7 @@ The new type is usable like any other type:
)
stmt = select([data.c.x.log(data.c.y)]).where(data.c.x.log(2) < value)
- print conn.execute(stmt).fetchall()
+ print(conn.execute(stmt).fetchall())
New features which have come from this immediately include
@@ -738,7 +738,7 @@ Above, the ``LowerString`` type defines a SQL expression that will be emitted
whenever the ``test_table.c.data`` column is rendered in the columns
clause of a SELECT statement::
- >>> print select([test_table]).where(test_table.c.data == 'HI')
+ >>> print(select([test_table]).where(test_table.c.data == 'HI'))
SELECT lower(test_table.data) AS data
FROM test_table
WHERE test_table.data = lower(:data_1)
@@ -764,7 +764,7 @@ an :class:`.Inspector` object::
engine = create_engine("postgresql://scott:tiger@localhost/test")
insp = inspect(engine)
- print insp.get_table_names()
+ print(insp.get_table_names())
It can also be applied to any :class:`.ClauseElement`, which returns
the :class:`.ClauseElement` itself, such as :class:`.Table`, :class:`.Column`,
@@ -947,7 +947,7 @@ on all :class:`.String` types and will render on any backend, including
when features such as :meth:`.MetaData.create_all` and :func:`.cast` is used::
>>> stmt = select([cast(sometable.c.somechar, String(20, collation='utf8'))])
- >>> print stmt
+ >>> print(stmt)
SELECT CAST(sometable.somechar AS VARCHAR(20) COLLATE "utf8") AS anon_1
FROM sometable
@@ -1208,7 +1208,7 @@ Within a SELECT, the correlation takes effect as expected::
s2 = select([t1, t2]).where(t1.c.x == t2.c.y).where(t1.c.x == s)
- print (s2)
+ print(s2)
SELECT t1.x, t2.y FROM t1, t2
WHERE t1.x = t2.y AND t1.x =
diff --git a/doc/build/changelog/migration_09.rst b/doc/build/changelog/migration_09.rst
index 9138157..e8dcb9f 100644
--- a/doc/build/changelog/migration_09.rst
+++ b/doc/build/changelog/migration_09.rst
@@ -550,7 +550,7 @@ The precedence rules for COLLATE have been changed
Previously, an expression like the following::
- print (column('x') == 'somevalue').collate("en_EN")
+ print((column('x') == 'somevalue').collate("en_EN"))
would produce an expression like this::
@@ -567,7 +567,7 @@ by that of most database documentation::
The potentially backwards incompatible change arises if the :meth:`.collate`
operator is being applied to the right-hand column, as follows::
- print column('x') == literal('somevalue').collate("en_EN")
+ print(column('x') == literal('somevalue').collate("en_EN"))
In 0.8, this produces::
@@ -584,11 +584,11 @@ The :meth:`.ColumnOperators.collate` operator now works more appropriately withi
generated::
>>> # 0.8
- >>> print column('x').collate('en_EN').desc()
+ >>> print(column('x').collate('en_EN').desc())
(x COLLATE en_EN) DESC
>>> # 0.9
- >>> print column('x').collate('en_EN').desc()
+ >>> print(column('x').collate('en_EN').desc())
x COLLATE en_EN DESC
:ticket:`2879`
@@ -606,7 +606,7 @@ signs within the enumerated values::
>>> from sqlalchemy.dialects import postgresql
>>> type = postgresql.ENUM('one', 'two', "three's", name="myenum")
>>> from sqlalchemy.dialects.postgresql import base
- >>> print base.CreateEnumType(type).compile(dialect=postgresql.dialect())
+ >>> print(base.CreateEnumType(type).compile(dialect=postgresql.dialect()))
CREATE TYPE myenum AS ENUM ('one','two','three''s')
Existing workarounds which already escape single quote signs will need to be
@@ -1085,7 +1085,7 @@ classes, including relationships, based on a reflected schema::
session.commit()
# collection-based relationships are by default named "<classname>_collection"
- print (u1.address_collection)
+ print(u1.address_collection)
Beyond that, the :class:`.AutomapBase` class is a declarative base, and supports
all the features that declarative does. The "automapping" feature can be used
@@ -1528,41 +1528,41 @@ on backends that don't feature ``true``/``false`` constant beahvior::
>>> from sqlalchemy import select, and_, false, true
>>> from sqlalchemy.dialects import mysql, postgresql
- >>> print select([t1]).where(t1.c.x).compile(dialect=mysql.dialect())
+ >>> print(select([t1]).where(t1.c.x).compile(dialect=mysql.dialect()))
SELECT t.x, t.y FROM t WHERE t.x = 1
The :func:`.and_` and :func:`.or_` constructs will now exhibit quasi
"short circuit" behavior, that is truncating a rendered expression, when a
:func:`.true` or :func:`.false` constant is present::
- >>> print select([t1]).where(and_(t1.c.y > 5, false())).compile(
- ... dialect=postgresql.dialect())
+ >>> print(select([t1]).where(and_(t1.c.y > 5, false())).compile(
+ ... dialect=postgresql.dialect()))
SELECT t.x, t.y FROM t WHERE false
:func:`.true` can be used as the base to build up an expression::
>>> expr = true()
>>> expr = expr & (t1.c.y > 5)
- >>> print select([t1]).where(expr)
+ >>> print(select([t1]).where(expr))
SELECT t.x, t.y FROM t WHERE t.y > :y_1
The boolean constants :func:`.true` and :func:`.false` themselves render as
``0 = 1`` and ``1 = 1`` for a backend with no boolean constants::
- >>> print select([t1]).where(and_(t1.c.y > 5, false())).compile(
- ... dialect=mysql.dialect())
+ >>> print(select([t1]).where(and_(t1.c.y > 5, false())).compile(
+ ... dialect=mysql.dialect()))
SELECT t.x, t.y FROM t WHERE 0 = 1
Interpretation of ``None``, while not particularly valid SQL, is at least
now consistent::
- >>> print select([t1.c.x]).where(None)
+ >>> print(select([t1.c.x]).where(None))
SELECT t.x FROM t WHERE NULL
- >>> print select([t1.c.x]).where(None).where(None)
+ >>> print(select([t1.c.x]).where(None).where(None))
SELECT t.x FROM t WHERE NULL AND NULL
- >>> print select([t1.c.x]).where(and_(None, None))
+ >>> print(select([t1.c.x]).where(and_(None, None)))
SELECT t.x FROM t WHERE NULL AND NULL
:ticket:`2804`
@@ -1586,7 +1586,7 @@ E.g. an example like::
stmt = select([expr]).order_by(expr)
- print stmt
+ print(stmt)
Prior to 0.9 would render as::
diff --git a/doc/build/changelog/migration_10.rst b/doc/build/changelog/migration_10.rst
index a4fbf11..e68f907 100644
--- a/doc/build/changelog/migration_10.rst
+++ b/doc/build/changelog/migration_10.rst
@@ -530,7 +530,7 @@ Given a mapping like the following::
A simple scenario that included "A.b" twice would fail to render
correctly::
- print sess.query(A, a1).order_by(a1.b)
+ print(sess.query(A, a1).order_by(a1.b))
This would order by the wrong column::
@@ -845,7 +845,7 @@ expressions are rendered as constants into the SELECT statement::
Column('y', Integer, default=func.somefunction()))
stmt = select([t.c.x])
- print t.insert().from_select(['x'], stmt)
+ print(t.insert().from_select(['x'], stmt))
Will render::
@@ -1384,7 +1384,7 @@ Starting with a mapping as::
A query that joins to ``A.bs`` twice::
- print s.query(A).join(A.bs).join(A.bs)
+ print(s.query(A).join(A.bs).join(A.bs))
Will render::
@@ -1407,7 +1407,7 @@ larger path will now emit a warning::
The bigger change involves when joining to an entity without using a
relationship-bound path. If we join to ``B`` twice::
- print s.query(A).join(B, B.a_id == A.id).join(B, B.a_id == A.id)
+ print(s.query(A).join(B, B.a_id == A.id).join(B, B.a_id == A.id))
In 0.9, this would render as follows::
@@ -1467,9 +1467,9 @@ a mapping as follows::
s = Session()
- print s.query(ASub1).join(B, ASub1.b).join(ASub2, B.a)
+ print(s.query(ASub1).join(B, ASub1.b).join(ASub2, B.a))
- print s.query(ASub1).join(B, ASub1.b).join(ASub2, ASub2.id == B.a_id)
+ print(s.query(ASub1).join(B, ASub1.b).join(ASub2, ASub2.id == B.a_id))
The two queries at the bottom are equivalent, and should both render
the identical SQL::
@@ -1499,7 +1499,7 @@ as all the subclasses normally refer to the same table::
asub2_alias = aliased(ASub2)
- print s.query(ASub1).join(B, ASub1.b).join(asub2_alias, B.a.of_type(asub2_alias))
+ print(s.query(ASub1).join(B, ASub1.b).join(asub2_alias, B.a.of_type(asub2_alias)))
:ticket:`3233`
:ticket:`3367`
diff --git a/doc/build/conf.py b/doc/build/conf.py
index b600743..46f3b0a 100644
--- a/doc/build/conf.py
+++ b/doc/build/conf.py
@@ -138,9 +138,9 @@ copyright = u'2007-2016, the SQLAlchemy authors and contributors'
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
-release = "1.0.12"
+release = "1.0.13"
-release_date = "February 15, 2016"
+release_date = "May 16, 2016"
site_base = os.environ.get("RTD_SITE_BASE", "http://www.sqlalchemy.org")
site_adapter_template = "docs_adapter.mako"
diff --git a/doc/build/core/connections.rst b/doc/build/core/connections.rst
index 72e1d6a..2c646bc 100644
--- a/doc/build/core/connections.rst
+++ b/doc/build/core/connections.rst
@@ -48,7 +48,7 @@ way is first procure a connection resource, which you get via the
connection = engine.connect()
result = connection.execute("select username from users")
for row in result:
- print "username:", row['username']
+ print("username:", row['username'])
connection.close()
The connection is an instance of :class:`.Connection`,
@@ -76,7 +76,7 @@ The above procedure can be performed in a shorthand way by using the
result = engine.execute("select username from users")
for row in result:
- print "username:", row['username']
+ print("username:", row['username'])
Where above, the :meth:`~.Engine.execute` method acquires a new
:class:`.Connection` on its own, executes the statement with that object,
@@ -251,7 +251,7 @@ of :class:`.Engine`::
result = engine.execute("select username from users")
for row in result:
- print "username:", row['username']
+ print("username:", row['username'])
In addition to "connectionless" execution, it is also possible
to use the :meth:`~.Executable.execute` method of
diff --git a/doc/build/core/custom_types.rst b/doc/build/core/custom_types.rst
index f3a3b2b..3290e4d 100644
--- a/doc/build/core/custom_types.rst
+++ b/doc/build/core/custom_types.rst
@@ -297,8 +297,8 @@ and use it in a :func:`.select` construct::
Column('geom_data', Geometry)
)
- print select([geometry]).where(
- geometry.c.geom_data == 'LINESTRING(189412 252431,189631 259122)')
+ print(select([geometry]).where(
+ geometry.c.geom_data == 'LINESTRING(189412 252431,189631 259122)'))
The resulting SQL embeds both functions as appropriate. ``ST_AsText``
is applied to the columns clause so that the return value is run through
@@ -315,7 +315,7 @@ with the labeling of the wrapped expression. Such as, if we rendered
a :func:`.select` against a :func:`.label` of our expression, the string
label is moved to the outside of the wrapped expression::
- print select([geometry.c.geom_data.label('my_data')])
+ print(select([geometry.c.geom_data.label('my_data')]))
Output::
@@ -361,10 +361,10 @@ transparently::
conn.execute(message.insert(), username="some user",
message="this is my message")
- print conn.scalar(
+ print(conn.scalar(
select([message.c.message]).\
where(message.c.username == "some user")
- )
+ ))
The ``pgp_sym_encrypt`` and ``pgp_sym_decrypt`` functions are applied
to the INSERT and SELECT statements::
@@ -425,7 +425,7 @@ associated with the :class:`.Integer` type.
Usage::
>>> sometable = Table("sometable", metadata, Column("data", MyInt))
- >>> print sometable.c.data + 5
+ >>> print(sometable.c.data + 5)
sometable.data goofy :data_1
The implementation for :meth:`.ColumnOperators.__add__` is consulted
@@ -452,7 +452,7 @@ to integers::
Using the above type::
- >>> print sometable.c.data.log(5)
+ >>> print(sometable.c.data.log(5))
log(:log_1, :log_2)
@@ -475,7 +475,7 @@ along with a :class:`.custom_op` to produce the factorial expression::
Using the above type::
>>> from sqlalchemy.sql import column
- >>> print column('x', MyInteger).factorial()
+ >>> print(column('x', MyInteger).factorial())
x !
See also:
diff --git a/doc/build/core/event.rst b/doc/build/core/event.rst
index ced81a6..1a81dba 100644
--- a/doc/build/core/event.rst
+++ b/doc/build/core/event.rst
@@ -30,7 +30,7 @@ and that a user-defined listener function should receive two positional argument
from sqlalchemy.pool import Pool
def my_on_connect(dbapi_con, connection_record):
- print "New DBAPI connection:", dbapi_con
+ print("New DBAPI connection:", dbapi_con)
listen(Pool, 'connect', my_on_connect)
@@ -41,7 +41,7 @@ To listen with the :func:`.listens_for` decorator looks like::
@listens_for(Pool, "connect")
def my_on_connect(dbapi_con, connection_record):
- print "New DBAPI connection:", dbapi_con
+ print("New DBAPI connection:", dbapi_con)
Named Argument Styles
---------------------
diff --git a/doc/build/core/metadata.rst b/doc/build/core/metadata.rst
index 24df3bc..5052e0e 100644
--- a/doc/build/core/metadata.rst
+++ b/doc/build/core/metadata.rst
@@ -58,7 +58,7 @@ dependency (that is, each table is preceded by all tables which it
references)::
>>> for t in metadata.sorted_tables:
- ... print t.name
+ ... print(t.name)
user
user_preference
invoice
@@ -93,15 +93,15 @@ table include::
# iterate through all columns
for c in employees.c:
- print c
+ print(c)
# get the table's primary key columns
for primary_key in employees.primary_key:
- print primary_key
+ print(primary_key)
# get the table's foreign key objects:
for fkey in employees.foreign_keys:
- print fkey
+ print(fkey)
# access the table's MetaData:
employees.metadata
diff --git a/doc/build/core/pooling.rst b/doc/build/core/pooling.rst
index f9384fd..65b5ca9 100644
--- a/doc/build/core/pooling.rst
+++ b/doc/build/core/pooling.rst
@@ -195,7 +195,7 @@ that they are replaced with new ones upon next checkout::
except exc.DBAPIError, e:
# an exception is raised, Connection is invalidated.
if e.connection_invalidated:
- print "Connection was invalidated!"
+ print("Connection was invalidated!")
# after the invalidate event, a new connection
# starts with a new Pool
@@ -253,6 +253,11 @@ best way to do this is to make use of the
# we don't want to bother pinging on these.
return
+ # turn off "close with result". This flag is only used with
+ # "connectionless" execution, otherwise will be False in any case
+ save_should_close_with_result = connection.should_close_with_result
+ connection.should_close_with_result = False
+
try:
# run a SELECT 1. use a core select() so that
# the SELECT of a scalar value without a table is
@@ -272,6 +277,9 @@ best way to do this is to make use of the
connection.scalar(select([1]))
else:
raise
+ finally:
+ # restore "close with result"
+ connection.should_close_with_result = save_should_close_with_result
The above recipe has the advantage that we are making use of SQLAlchemy's
facilities for detecting those DBAPI exceptions that are known to indicate
diff --git a/doc/build/core/reflection.rst b/doc/build/core/reflection.rst
index 57389cb..f70e3be 100644
--- a/doc/build/core/reflection.rst
+++ b/doc/build/core/reflection.rst
@@ -125,7 +125,7 @@ database is also available. This is known as the "Inspector"::
from sqlalchemy.engine import reflection
engine = create_engine('...')
insp = reflection.Inspector.from_engine(engine)
- print insp.get_table_names()
+ print(insp.get_table_names())
.. autoclass:: sqlalchemy.engine.reflection.Inspector
:members:
diff --git a/doc/build/faq/metadata_schema.rst b/doc/build/faq/metadata_schema.rst
index 9697399..7e4a557 100644
--- a/doc/build/faq/metadata_schema.rst
+++ b/doc/build/faq/metadata_schema.rst
@@ -64,7 +64,7 @@ This is available via the :attr:`.MetaData.sorted_tables` function::
# ... add Table objects to metadata
ti = metadata.sorted_tables:
for t in ti:
- print t
+ print(t)
How can I get the CREATE TABLE/ DROP TABLE output as a string?
===========================================================================
@@ -74,17 +74,17 @@ can be rendered to strings like any other SQL expression::
from sqlalchemy.schema import CreateTable
- print CreateTable(mytable)
+ print(CreateTable(mytable))
To get the string specific to a certain engine::
- print CreateTable(mytable).compile(engine)
+ print(CreateTable(mytable).compile(engine))
There's also a special form of :class:`.Engine` that can let you dump an entire
metadata creation sequence, using this recipe::
def dump(sql, *multiparams, **params):
- print sql.compile(dialect=engine.dialect)
+ print(sql.compile(dialect=engine.dialect))
engine = create_engine('postgresql://', strategy='mock', executor=dump)
metadata.create_all(engine, checkfirst=False)
diff --git a/doc/build/faq/ormconfiguration.rst b/doc/build/faq/ormconfiguration.rst
index 3a2ea29..faaee44 100644
--- a/doc/build/faq/ormconfiguration.rst
+++ b/doc/build/faq/ormconfiguration.rst
@@ -89,7 +89,8 @@ To get at the :class:`.Mapper` for a particular mapped class, call the
mapper = inspect(MyClass)
-From there, all information about the class can be acquired using such methods as:
+From there, all information about the class can be accessed through properties
+such as:
* :attr:`.Mapper.attrs` - a namespace of all mapped attributes. The attributes
themselves are instances of :class:`.MapperProperty`, which contain additional
diff --git a/doc/build/faq/performance.rst b/doc/build/faq/performance.rst
index 8413cb5..21fae65 100644
--- a/doc/build/faq/performance.rst
+++ b/doc/build/faq/performance.rst
@@ -104,7 +104,7 @@ Below is a simple recipe which works profiling into a context manager::
ps.print_stats()
# uncomment this to see who's calling what
# ps.print_callers()
- print s.getvalue()
+ print(s.getvalue())
To profile a section of code::
diff --git a/doc/build/faq/sessions.rst b/doc/build/faq/sessions.rst
index 8a47db7..ee280ae 100644
--- a/doc/build/faq/sessions.rst
+++ b/doc/build/faq/sessions.rst
@@ -282,11 +282,11 @@ one::
class Iterates(object):
def __len__(self):
- print "LEN!"
+ print("LEN!")
return 5
def __iter__(self):
- print "ITER!"
+ print("ITER!")
return iter([1, 2, 3, 4, 5])
list(Iterates())
@@ -477,7 +477,7 @@ The function can be demonstrated as follows::
for obj in walk(a1):
- print obj
+ print(obj)
Output::
diff --git a/doc/build/glossary.rst b/doc/build/glossary.rst
index 5f68624..75eecb4 100644
--- a/doc/build/glossary.rst
+++ b/doc/build/glossary.rst
@@ -60,7 +60,7 @@ Glossary
``__delete__()`` methods. The :class:`.InstrumentedAttribute`
will generate a SQL expression when used at the class level::
- >>> print MyClass.data == 5
+ >>> print(MyClass.data == 5)
data = :data_1
and at the instance level, keeps track of changes to values,
@@ -103,7 +103,7 @@ Glossary
Instrumentation refers to the process of augmenting the functionality
and attribute set of a particular class. Ideally, the
behavior of the class should remain close to a regular
- class, except that additional behviors and features are
+ class, except that additional behaviors and features are
made available. The SQLAlchemy :term:`mapping` process,
among other things, adds database-enabled :term:`descriptors`
to a mapped
@@ -246,7 +246,7 @@ Glossary
transactional resources", to indicate more explicitly that
what we are actually "releasing" is any transactional
state which as accumulated upon the connection. In most
- situations, the proces of selecting from tables, emitting
+ situations, the process of selecting from tables, emitting
updates, etc. acquires :term:`isolated` state upon
that connection as well as potential row or table locks.
... 2802 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sqlalchemy.git
More information about the Python-modules-commits
mailing list