==============
The third-party dialect can be distributed like any other Python
-module on Pypi. Links to prominent dialects can be featured within
+module on PyPI. Links to prominent dialects can be featured within
SQLAlchemy's own documentation; contact the developers (see AUTHORS)
for help with this.
created for a class, qualified by the entity name. instances of those classes
will issue all of their load and save operations through their
entity_name-qualified mapper, and maintain separate a identity in the identity
- map for an otherwise equilvalent object.
+ map for an otherwise equivalent object.
.. change::
:tags:
:tags:
:tickets:
- began to implement newer logic in object properities. you can now say
+ began to implement newer logic in object properties. you can now say
myclass.attr.property, which will give you the PropertyLoader corresponding to that
attribute, i.e. myclass.mapper.props['attr']
:tickets:
fix to engine.process_defaults so it works correctly with a table that has
- different column name/column keys (changset 982)
+ different column name/column keys (changeset 982)
.. change::
:tags:
:tags:
:tickets:
- modifcation to unitofwork to not maintain ordering within the
+ modification to unitofwork to not maintain ordering within the
"new" list or within the UOWTask "objects" list; instead, new objects
are tagged with an ordering identifier as they are registered as new
with the session, and the INSERT statements are then sorted within the
:tags:
:tickets:
- fixes to session cascade behavior, entity_name propigation
+ fixes to session cascade behavior, entity_name propagation
.. change::
:tags:
overhaul to Schema to build upon MetaData object instead of an Engine.
Entire SQL/Schema system can be used with no Engines whatsoever, executed
- solely by an explicit Connection object. the "bound" methodlogy exists via the
+ solely by an explicit Connection object. the "bound" methodology exists via the
BoundMetaData for schema objects. ProxyEngine is generally not needed
anymore and is replaced by DynamicMetaData.
:tickets:
backrefs create themselves against primary mapper of its originating
- property, priamry/secondary join arguments can be specified to override.
+ property, primary/secondary join arguments can be specified to override.
helps their usage with polymorphic mappers
.. change::
:tags: sql
:tickets: 667
- foreign key specs can have any chararcter in their identifiers
+ foreign key specs can have any character in their identifiers
.. change::
:tags: sql
and the key will be shared. proper positional/named args translate
at compile time. for the old behavior of "aliasing" bind parameters
with conflicting names, specify "unique=True" - this option is
- still used internally for all the auto-genererated (value-based)
+ still used internally for all the auto-generated (value-based)
bind parameters.
.. change::
:tickets:
some fixes to relationship calcs when using "viewonly=True" to pull
- in other tables into the join condition which arent parent of the
+ in other tables into the join condition which aren't parent of the
relationship's parent/child mappings
.. change::
the value of "case_sensitive" defaults to True now, regardless of the
casing of the identifier, unless specifically set to False. this is
because the object might be label'ed as something else which does
- contain mixed case, and propigating "case_sensitive=False" breaks that.
+ contain mixed case, and propagating "case_sensitive=False" breaks that.
Other fixes to quoting when using labels and "fake" column objects
.. change::
index=True/unique=False creates a plain Index,
index=True/unique=True on Column creates a unique Index. 'index'
and 'unique' keyword arguments to column are now boolean only; for
- explcit names and groupings of indexes or unique constraints, use the
+ explicit names and groupings of indexes or unique constraints, use the
UniqueConstraint/Index constructs explicitly.
.. change::
:tickets:
fixed condition that occurred during reflection when a primary key
- column was explciitly overridden, where the PrimaryKeyConstraint would
+ column was explicitly overridden, where the PrimaryKeyConstraint would
get both the reflected and the programmatic column doubled up
.. change::
:tickets: 1036
repaired single table inheritance such that you
- can single-table inherit from a joined-table inherting
+ can single-table inherit from a joined-table inheriting
mapper without issue.
.. change::
whether or not it remains attached to its also-deleted
parent.
- - delete-orphan casacde is properly detected on relations
+ - delete-orphan cascade is properly detected on relations
that are present on superclasses when using inheritance.
.. change::
MSSQL
- PyODBC no longer has a global "set nocount on".
- - Fix non-identity integer PKs on autload
+ - Fix non-identity integer PKs on autoload
- Better support for convert_unicode
- Less strict date conversion for pyodbc/adodbapi
- Schema-qualified tables / autoload
:tickets:
Renamed the Dialect attribute 'preexecute_sequences' to
- 'preexecute_pk_sequences'. An attribute porxy is in place for
+ 'preexecute_pk_sequences'. An attribute proxy is in place for
out-of-tree dialects using the old name.
.. change::
:tickets:
Hooks added throughout base/sql/defaults to optimize the calling of bind
- aram/result processors so that method call overhead is minimized.
+ param/result processors so that method call overhead is minimized.
.. change::
:tags:
:tags: metadata
:tickets:
- Added "explcit" create/drop/execute support for sequences (i.e. you can
+ Added "explicit" create/drop/execute support for sequences (i.e. you can
pass a "connectable" to each of those methods on Sequence).
.. change::
Fixed Query being able to join() from individual columns of a
joined-table subclass entity, i.e. query(SubClass.foo,
- SubcClass.bar).join(<anything>). In most cases, an error
+ SubClass.bar).join(<anything>). In most cases, an error
"Could not find a FROM clause to join from" would be
raised. In a few others, the result would be returned in terms
of the base class rather than the subclass - so applications
the AttributeExtension interface nor any of the publicly
documented attribute functions.
- - The unit of work no longer genererates a graph of "dependency"
+ - The unit of work no longer generates a graph of "dependency"
processors for the full graph of mappers during flush(), instead
creating such processors only for those mappers which represent
objects with pending changes. This saves a tremendous number
Query won't fail with weakref error when a non-mapper/class
instrumented descriptor is passed, raises
- "Invalid column expession".
+ "Invalid column expression".
.. change::
:tags: orm
:tickets: 1237, 781
Added a new `relation()` keyword `back_populates`. This
- allows configuation of backreferences using explicit
+ allows configuration of backreferences using explicit
relations. This is required when creating
bidirectional relations between a hierarchy of concrete
mappers and another class.
Added a rudimental series of set operations to Query that
receive Query objects as arguments, including union(),
- union_all(), intersect(), except_(), insertsect_all(),
+ union_all(), intersect(), except_(), intersect_all(),
except_all(). See the API documentation for
Query.union() for examples.
Using delete-orphan on a many-to-many relation is deprecated.
This produces misleading or erroneous results since SQLA does
not retrieve the full list of "parents" for m2m. To get delete-orphan
- behavior with an m2m table, use an explcit association class
+ behavior with an m2m table, use an explicit association class
so that the individual association row is treated as a parent.
.. change::
Added more granularity to internal attribute access, such that
cascade and flush operations will not initialize unloaded
attributes and collections, leaving them intact for a
- lazy-load later on. Backref events still initialize attrbutes
+ lazy-load later on. Backref events still initialize attributes
and collections for pending instances.
.. change::
cleanup() were not explicitly closed, leaving garbage
collection to the task instead. This generally only
affects non-reference-counting backends like Jython
- and Pypy. Thanks to Jaimy Azle for spotting
+ and PyPy. Thanks to Jaimy Azle for spotting
this.
.. change::
@classproperty 's official name/location for usage
with declarative is sqlalchemy.ext.declarative.declared_attr.
Same thing, but moving there since it is more of a
- "marker" that's specific to declararative,
+ "marker" that's specific to declarative,
not just an attribute technique.
.. change::
:tags: oracle
:tickets: 1878
- The implicit_retunring argument to create_engine()
+ The implicit_returning argument to create_engine()
is now honored regardless of detected version of
Oracle. Previously, the flag would be forced
to False if server version info was < 10.
Added a mutex to the identity map which mutexes
remove operations against iteration methods,
which now pre-buffer before returning an
- iterable. This because asyncrhonous gc
+ iterable. This because asynchronous gc
can remove items via the gc thread at any time.
.. change::
:tags: sql
:tickets: 1571
- Fixed "table" argument on constructor of ForeginKeyConstraint
+ Fixed "table" argument on constructor of ForeignKeyConstraint
.. change::
:tags: sql
session, using autocommit=False, autoflush=True. Default
behavior of SQLSoup now requires the usual usage of commit()
and rollback(), which have been added to its interface. An
- explcit Session or scoped_session can be passed to the
+ explicit Session or scoped_session can be passed to the
constructor, allowing these arguments to be overridden.
.. change::
Fixed compiler bug whereby using a correlated
subquery within an ORDER BY would fail to render correctly
- if the stament also used LIMIT/OFFSET, due to mis-rendering
+ if the statement also used LIMIT/OFFSET, due to mis-rendering
within the ROW_NUMBER() OVER clause. Fix courtesy
sayap
:tags: general
:tickets:
- Lots of fixes to unit tests when run under Pypy
+ Lots of fixes to unit tests when run under PyPy
(courtesy Alex Gaynor).
.. change::
:tickets: 3044
Fixed bug in INSERT..FROM SELECT construct where selecting from a
- UNION would wrap the union in an anonymous (e.g. unlabled) subquery.
+ UNION would wrap the union in an anonymous (e.g. unlabeled) subquery.
.. change::
:tags: bug, postgresql
Fixed bug in :func:`.tuple_` construct where the "type" of essentially
the first SQL expression would be applied as the "comparison type"
to a compared tuple value; this has the effect in some cases of an
- inappropriate "type coersion" occurring, such as when a tuple that
+ inappropriate "type coercion" occurring, such as when a tuple that
has a mix of String and Binary values improperly coerces target
values to Binary even though that's not what they are on the left
side. :func:`.tuple_` now expects heterogeneous types within its
by the database (such as PostgreSQL ``oid`` or ``xmin``). The
column will be omitted from the ``CREATE TABLE`` statement but will
otherwise be available for querying. In addition, the
- :class:`.CreateColumn` construct can be appled to a custom
+ :class:`.CreateColumn` construct can be applied to a custom
compilation rule which allows skipping of columns, by producing
a rule that returns ``None``.
Fixed a potential issue in an ordered sequence implementation used
by the ORM to iterate mapper hierarchies; under the Jython interpreter
- this implementation wasn't ordered, even though cPython and Pypy
+ this implementation wasn't ordered, even though cPython and PyPy
maintained ordering.
.. change::
custom collections using an ``__instrumentation__`` datastructure
associated with the collection has been removed, as this was a complex
and untested feature which was also essentially redundant versus the
- decorator approach. Other internal simplifcations to the
+ decorator approach. Other internal simplifications to the
orm.collections module have been made as well.
.. change::
UPDATE..FROM syntax as allowed by the dialect
to satisfy the WHERE clause. MySQL's multi-table
update feature is also supported if columns
- are specified by object in the "values" dicitionary.
+ are specified by object in the "values" dictionary.
PG's DELETE..USING is also not available
in Core yet.
:tags: feature, sql
:tickets:
- The Core oeprator system now includes
+ The Core operator system now includes
the `getitem` operator, i.e. the bracket
operator in Python. This is used at first
to provide index and slice behavior to the
:class:`.Query` before it fetched results, particularly when
row processors can't be formed, the cursor would stay open with
results pending and not actually be closed. This is typically only
- an issue on an interpreter like Pypy where the cursor isn't
+ an issue on an interpreter like PyPy where the cursor isn't
immediately GC'ed, and can in some circumstances lead to transactions/
locks being open longer than is desirable.
:tags: bug, examples
:versions: 1.0.0b1
- Fixed a bug in the examples/generic_assocaitions/discriminator_on_association.py
+ Fixed a bug in the examples/generic_associations/discriminator_on_association.py
example, where the subclasses of AddressAssociation were not being
mapped as "single table inheritance", leading to problems when trying
to use the mappings further.
* A new parameter :paramref:`.JSON.none_as_null` is added, which
when True indicates that the Python ``None`` value should be
- peristed as SQL NULL, rather than JSON-encoded ``'null'``.
+ persisted as SQL NULL, rather than JSON-encoded ``'null'``.
Retrival of NULL as None is also repaired for DBAPIs other than
psycopg2, namely pg8000.
:tags: bug, testsuite
:versions: 1.0.0b1
- In public test suite, shanged to use of ``String(40)`` from
+ In public test suite, changed to use of ``String(40)`` from
less-supported ``Text`` in ``StringTest.test_literal_backslashes``.
Pullreq courtesy Jan.
in some cases a scalar attribute set to None, may not be detected
as a net change in value, and therefore the UPDATE would not reset
what was on the previous row. This is due to some as-yet
- unresovled side effects of the way attribute history works in terms
+ unresolved side effects of the way attribute history works in terms
of implicitly assuming None isn't really a "change" for a previously
un-set attribute. See also :ticket:`3061`.
Added new flag :paramref:`.expression.between.symmetric`, when set to True
renders "BETWEEN SYMMETRIC". Also added a new negation operator
"notbetween_op", which now allows an expression like ``~col.between(x, y)``
- to render as "col NOT BETWEEN x AND y", rather than a parentheiszed NOT
+ to render as "col NOT BETWEEN x AND y", rather than a parenthesized NOT
string.
.. changelog::
(except when version_id is used) to support the unusual edge case of
self-referential ON DELETE CASCADE; to accommodate this, the message
is now just a warning, not an exception, and the flag can be used
- to indicate a mapping that expects self-refererntial cascaded
+ to indicate a mapping that expects self-referential cascaded
deletes of this nature. See also :ticket:`2403` for background on the
original change.
cx_Oracle dialect, which restores the cx_Oracle outputtypehandler
approach to Python unicode conversion under Python 2, which was
removed in 0.9.2 as a result of :ticket:`2911`. Some use cases would
- prefer that unicode coersion is unconditional for all string values,
+ prefer that unicode coercion is unconditional for all string values,
despite performance concerns. Pull request courtesy
Christoph Zwerschke.
:tags: feature, pool, engine
Added a new pool event :meth:`.PoolEvents.invalidate`. Called when
- a DBAPI connection is to be marked as "invaldated" and discarded
+ a DBAPI connection is to be marked as "invalidated" and discarded
from the pool.
.. change::
The :func:`.create_engine` routine and the related
:func:`.make_url` function no longer considers the ``+`` sign
to be a space within the password field. The parsing has been
- adjuted to match RFC 1738 exactly, in that both ``username``
+ adjusted to match RFC 1738 exactly, in that both ``username``
and ``password`` expect only ``:``, ``@``, and ``/`` to be
encoded.
The PostgreSQL and MySQL dialects now support reflection/inspection
of foreign key options, including ON UPDATE, ON DELETE. PostgreSQL
- also reflects MATCH, DEFERRABLE, and INITIALLY. Coutesy ijl.
+ also reflects MATCH, DEFERRABLE, and INITIALLY. Courtesy ijl.
.. change::
:tags: bug, mysql
to rely upon server generated version identifiers, using triggers
or other database-provided versioning features, or via an optional programmatic
value, by setting ``version_id_generator=False``.
- When using a server-generated version identfier, the ORM will use RETURNING when
+ When using a server-generated version identifier, the ORM will use RETURNING when
available to immediately
load the new version value, else it will emit a second SELECT.
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
+ inheritance hierarchy in conjunction with multiple mapper configuration
steps.
.. change::
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.
+ of interpreting the object as a SQL fragment.
.. change::
:tags: bug, oracle
:tags: bug, sql
:tickets: 3490
- Fixed bug where coersion of literal ``True`` or ``False`` constant
+ Fixed bug where coercion of literal ``True`` or ``False`` constant
in conjunction with :func:`.and_` or :func:`.or_` would fail
with an AttributeError.
Fixed regression from 0.9.10 prior to release due to :ticket:`3349`
where the check for query state on :meth:`.Query.update` or
:meth:`.Query.delete` compared the empty tuple to itself using ``is``,
- which fails on Pypy to produce ``True`` in this case; this would
+ which fails on PyPy to produce ``True`` in this case; this would
erronously emit a warning in 0.9 and raise an exception in 1.0.
.. change::
:tickets: 3330, 3329
The "auto close" for :class:`.ResultProxy` is now a "soft" close.
- That is, after exhausing all rows using the fetch methods, the
+ That is, after exhausting all rows using the fetch methods, the
DBAPI cursor is released as before and the object may be safely
discarded, but the fetch methods may continue to be called for which
they will return an end-of-result object (None for fetchone, empty list
A similar change is also applied to an INSERT..VALUES
with multiple parameter sets; implicit RETURNING will no longer emit
for this statement either. As both of these constructs deal
- with varible numbers of rows, the
+ with variable numbers of rows, the
:attr:`.ResultProxy.inserted_primary_key` accessor does not
apply. Previously, there was a documentation note that one
may prefer ``inline=True`` with INSERT..FROM SELECT as some databases
duplicate object identities to occur, particularly under joined eager
loading which involves deduplication of objects. The issue is specific
to garbage collection of weak references and is observed only under the
- Pypy interpreter.
+ PyPy interpreter.
.. change::
:tags: bug, orm
:released: July 24, 2017
.. change:: cache_order_sequence
- :tags: feature, oracle, posgresql
+ :tags: feature, oracle, postgresql
:versions: 1.2.0b1
Added new keywords :paramref:`.Sequence.cache` and
:tickets: 3744
Fixed bug in new CTE feature for update/insert/delete whereby
- an anoymous (e.g. no name passed) :class:`.CTE` construct around
+ an anonymous (e.g. no name passed) :class:`.CTE` construct around
the statement would fail.
.. change::
.. change::
:tags: feature, postgresql
-3
+
Added new parameter
:paramref:`.GenerativeSelect.with_for_update.key_share`, which
will render the ``FOR NO KEY UPDATE`` version of ``FOR UPDATE``
would also occur for a row that is to be deleted following the update,
meaning both that a column with a Python-side value generator would show
the now-deleted value that was emitted for the UPDATE before the DELETE
- (which was not the previous behavor), as well as that a SQL- emitted value
+ (which was not the previous behavior), as well as that a SQL- emitted value
generator would have the attribute expired, meaning the previous value
would be unreachable due to the row having been deleted and the object
detached from the session.The "postfetch" logic that was added as part of
Fixed issue that is closely related to :ticket:`3639` where an expression
rendered in a boolean context on a non-native boolean backend would
- be compared to 1/0 even though it is already an implcitly boolean
+ be compared to 1/0 even though it is already an implicitly boolean
expression, when :meth:`.ColumnElement.self_group` were used. While this
does not affect the user-friendly backends (MySQL, SQLite) it was not
handled by Oracle (and possibly SQL Server). Whether or not the
expression is implicitly boolean on any database is now determined
up front as an additional check to not generate the integer comparison
- within the compliation of the statement.
+ within the compilation of the statement.
.. change::
:tags: bug, oracle
:tickets: 4293
Fixed bug in index reflection where on MySQL 8.0 an index that includes
- ASC or DESC in an indexed column specfication would not be correctly
+ ASC or DESC in an indexed column specification would not be correctly
reflected, as MySQL 8.0 introduces support for returning this information
in a table definition string.
:class:`.MapperOption` will now cause lazy loaders related to
the target object to use a non-baked query by default unless
the :meth:`.MapperOption._generate_cache_key` method is implemented.
- In particular, this repairs one regression which occured when
+ In particular, this repairs one regression which occurred when
using the dogpile.cache "advanced" example, which was not
returning cached results and instead emitting SQL due to an
incompatibility with the baked query loader; with the change,
Fixed a regression that occurred from the previous fix to :ticket:`4204` in
version 1.2.5, where a CTE that refers to itself after the
- :meth:`.CTE.alias` method has been called would not refer to iself
+ :meth:`.CTE.alias` method has been called would not refer to itself
correctly.
.. change::
Removed a warning that would be emitted when calling upon
``__table_args__``, ``__mapper_args__`` as named with a ``@declared_attr``
method, when called from a non-mapped declarative mixin. Calling these
- directly is documented as the approach to use when one is overidding one
+ directly is documented as the approach to use when one is overriding one
of these methods on a mapped class. The warning still emits for regular
attribute names.
Fixed bug where the :class:`.Bundle` object did not
correctly report upon the primary :class:`.Mapper` object
- represened by the bundle, if any. An immediate
+ represented by the bundle, if any. An immediate
side effect of this issue was that the new selectinload
loader strategy wouldn't work with the horizontal sharding
extension.
Fixed issue where the :func:`.make_transient_to_detached` function
would expire all attributes on the target object, including "deferred"
attributes, which has the effect of the attribute being undeferred
- for the next refesh, causing an unexpected load of the attribute.
+ for the next refresh, causing an unexpected load of the attribute.
.. change::
:tags: bug, orm
by the mapper as well as loader strategies reach their threshold; the
purpose of this warning was at first a guard against excess cache keys
being generated but became basically a check on the "creating many
- engines" antipattern. While this is still an antipattern, the presense
+ engines" antipattern. While this is still an antipattern, the presence
of test suites which both create an engine per test as well as raise
on all warnings will be an inconvenience; it should not be critical
that such test suites change their architecture just for this warning
when "RETURNING", which on SQL Server looks like "OUTPUT inserted", is in
use, as the PyODBC backend isn't able to give us rowcount on an UPDATE or
DELETE statement when OUTPUT is in effect. This primarily affects the ORM
- when a flush is updating a row that contains server-calcluated values,
+ when a flush is updating a row that contains server-calculated values,
raising an error if the backend does not return the expected row count.
PyODBC now states that it supports rowcount except if OUTPUT.inserted is
present, which is taken into account by the ORM during a flush as to
passed to SQL statements. A "float" value will be associated with the
:class:`.Float` datatype and not the Decimal-coercing :class:`.Numeric`
datatype as was the case before, eliminating a confusing warning
- emitted on SQLite as well as unecessary coercion to Decimal.
+ emitted on SQLite as well as unnecessary coercion to Decimal.
.. seealso::
each other will produce parentheses between them. This suits the
stated operator precedence of databases like Oracle, MySQL and others
which place all of these operators as equal precedence, as well as
- PostgreSQL as of 9.5 which has also flattened its operator precendence.
+ PostgreSQL as of 9.5 which has also flattened its operator precedence.
.. seealso::
:tickets: 4196
Added support for bulk :meth:`.Query.update` and :meth:`.Query.delete`
- to the :class:`.ShardedQuery` class within the horiziontal sharding
+ to the :class:`.ShardedQuery` class within the horizontal sharding
extension. This also adds an additional expansion hook to the
bulk update/delete methods :meth:`.Query._execute_crud`.
Available at the Engine and ORM level. ORM docs so far:
-http://www.sqlalchemy.org/docs/04/session.html#unitofwork_ma
-naging
+http://www.sqlalchemy.org/docs/04/session.html#unitofwork_managing
Two-Phase Commit Sessions
^^^^^^^^^^^^^^^^^^^^^^^^^
Available at the Engine and ORM level. ORM docs so far:
-http://www.sqlalchemy.org/docs/04/session.html#unitofwork_ma
-naging
+http://www.sqlalchemy.org/docs/04/session.html#unitofwork_managing
Inheritance
-----------
SQL operators and more or less every SQL keyword there is
are now abstracted into the compiler layer. They now act
-intelligently and are type/backend aware, see: http://www.sq
-lalchemy.org/docs/04/sqlexpression.html#sql_operators
+intelligently and are type/backend aware, see:
+http://www.sqlalchemy.org/docs/04/sqlexpression.html#sql_operators
All ``type`` Keyword Arguments Renamed to ``type_``
---------------------------------------------------
loading. This is a load that emits a second SQL query
immediately after the first which loads full collections for
all the parents in the first query, joining upwards to the
-parent using INNER JOIN. Subquery loading is used simlarly
+parent using INNER JOIN. Subquery loading is used similarly
to the current joined-eager loading, using the
```subqueryload()```` and ````subqueryload_all()```` options
as well as the ````lazy='subquery'```` setting on
This is as of 0.7b4. The exts will build if cPython 2.xx
is detected. If the build fails, such as on a windows
install, that condition is caught and the non-C install
-proceeds. The C exts won't build if Python 3 or Pypy is
+proceeds. The C exts won't build if Python 3 or PyPy is
used.
Query.count() simplified, should work virtually always
in the ORM layer, using :func:`.column_property` given a
``comparator_factory`` argument. Third party libraries
like GeoAlchemy therefore were forced to be ORM-centric and
-rely upon an array of hacks to apply new opertions as well
+rely upon an array of hacks to apply new operations as well
as to get them to propagate correctly.
The new operator system in Core adds the one hook that's
The methods :meth:`.MetaData.create_all` and :meth:`.MetaData.drop_all`
will now accept a list of :class:`.Table` objects that is empty,
and will not emit any CREATE or DROP statements. Previously,
-an empty list was interepreted the same as passing ``None``
+an empty list was interpreted the same as passing ``None``
for a collection, and CREATE/DROP would be emitted for all
items unconditionally.
For whatever reason, the Python function ``unquote_plus()`` was applied to the
"password" field of a URL, which is an incorrect application of the
encoding rules described in `RFC 1738 <http://www.ietf.org/rfc/rfc1738.txt>`_
-in that it escaped spaces as plus signs. The stringiciation of a URL
+in that it escaped spaces as plus signs. The stringification of a URL
now only encodes ":", "@", or "/" and nothing else, and is now applied to both the
``username`` and ``password`` fields (previously it only applied to the
password). On parsing, encoded characters are converted, but plus signs and
The :meth:`.Join.alias`, :func:`.aliased` and :func:`.with_polymorphic` functions now
support a new argument, ``flat=True``, which is used to construct aliases of joined-table
entities without embedding into a SELECT. This flag is not on by default, to help with
-backwards compatibility - but now a "polymorhpic" selectable can be joined as a target
+backwards compatibility - but now a "polymorphic" selectable can be joined as a target
without any subqueries generated::
employee_alias = with_polymorphic(Person, [Engineer, Manager], flat=True)
t1 = Table('t', MetaData(), Column('x', Boolean()), Column('y', Integer))
A select construct will now render the boolean column as a binary expression
-on backends that don't feature ``true``/``false`` constant beahvior::
+on backends that don't feature ``true``/``false`` constant behavior::
>>> from sqlalchemy import select, and_, false, true
>>> from sqlalchemy.dialects import mysql, postgresql
collection. This includes :class:`.hybrid_property` and :func:`.association_proxy`.
However, as these objects are class-bound descriptors, they must be accessed
**separately** from the class to which they are attached in order to get
-at the attribute. Below this is illustared using the
+at the attribute. Below this is illustrated using the
:attr:`.Mapper.all_orm_descriptors` namespace::
class SomeObject(Base):
Changes here encompass bugs where an unexpected and inconsistent
behavior would occur in some scenarios when joining to an entity
-twice, or to multple single-table entities against the same table,
+twice, or to multiple single-table entities against the same table,
without using a relationship-based ON clause, as well as when joining
multiple times to the same target relationship.
.. _bug_3288:
-Python-side defaults invoked for each row invidually when using a multivalued insert
-------------------------------------------------------------------------------------
+Python-side defaults invoked for each row individually when using a multivalued insert
+--------------------------------------------------------------------------------------
Support for Python-side column defaults when using the multi-valued
version of :meth:`.Insert.values` were essentially not implemented, and
A similar change is also applied to an INSERT..VALUES
with multiple parameter sets; implicit RETURNING will no longer emit
for this statement either. As both of these constructs deal
-with varible numbers of rows, the
+with variable numbers of rows, the
:attr:`.ResultProxy.inserted_primary_key` accessor does not
apply. Previously, there was a documentation note that one
may prefer ``inline=True`` with INSERT..FROM SELECT as some databases
JSONB is supported natively.
-Support for psycopg2cffi Dialect on Pypy
+Support for psycopg2cffi Dialect on PyPy
----------------------------------------
Support for the pypy psycopg2cffi dialect is added.
* Because the query only fetches for a given list of primary key identifiers,
"selectin" loading is potentially compatible with :meth:`.Query.yield_per` to
operate on chunks of a SELECT result at a time, provided that the
- database driver allows for multiple, simultaneous cursors (SQlite, PostgreSQL;
+ database driver allows for multiple, simultaneous cursors (SQLite, PostgreSQL;
**not** MySQL drivers or SQL Server ODBC drivers). Neither joined eager
loading nor subquery eager loading are compatible with :meth:`.Query.yield_per`.
True/False/None value is passed. Additionally, only the integer values
0 and 1 are accepted.
-To accomodate for applications that wish to have more liberal interpretation
+To accommodate for applications that wish to have more liberal interpretation
of boolean values, the :class:`.TypeDecorator` should be used. Below
illustrates a recipe that will allow for the "liberal" behavior of the pre-1.1
:class:`.Boolean` datatype::
A default generation function, e.g. that described at
:ref:`context_default_functions`, can look at the current parameters relevant
-to the statment via the :attr:`.DefaultExecutionContext.current_parameters`
+to the statement via the :attr:`.DefaultExecutionContext.current_parameters`
attribute. However, in the case of a :class:`.Insert` construct that specifies
multiple VALUES clauses via the :meth:`.Insert.values` method, the user-defined
function is called multiple times, once for each parameter set, however there
incoming objects are already instances of ``B`` as it attempts to compare them
to the existing members of the collection, before doing collection appends
which actually invoke the validator. This would make it impossible for bulk
-set operations to accomodate non-ORM objects like dictionaries that needed
+set operations to accommodate non-ORM objects like dictionaries that needed
up-front modification::
a1 = A()
method only once, for the ``b3`` object. The ``b2`` object would be seen
as being already present in the collection and not validated. With the new
behavior, both ``b2`` and ``b3`` are passed to ``A.validate_b`` before passing
-onto the collection. It is thus important that valiation methods employ
+onto the collection. It is thus important that validation methods employ
idempotent behavior to suit such a case.
.. seealso::
a new :class:`.Session`. The keyword has never been documented and will
now raise ``TypeError`` if encountered. It is not anticipated that this
keyword is in use, however if users report issues related to this during
-beta tesing, it can be restored with a deprecation.
+beta testing, it can be restored with a deprecation.
:ticket:`3796`
in case a call like ``cursor.fetchmany()`` or ``cursor.fetchall()`` were
used.
- The dialect now makes use of a cx_Oracle outpttypehandler to handle these
+ The dialect now makes use of a cx_Oracle outputtypehandler to handle these
``.read()`` calls, so that they are always called up front regardless of how
many rows are being fetched, so that this error can no longer occur. As a
result, the use of the ``BufferedColumnResultSet``, as well as some other
SELECT ...
FROM users AS users_1, users JOIN addresses ON users.id = addresses.user_id
-That is, the JOIN would implcitly be against the first entity that matches.
+That is, the JOIN would implicitly be against the first entity that matches.
The new behavior is that an exception requests that this ambiguity be
resolved::
MyLargeBinary = LargeBinary().with_variant(CompressedLargeBinary(), "sqlite")
-The above expression will render a function within SQL when used on SQlite only::
+The above expression will render a function within SQL when used on SQLite only::
from sqlalchemy import select, column
from sqlalchemy.dialects import sqlite
------------------------------------------------------------
The order of UPDATE parameters in the ``ON DUPLICATE KEY UPDATE`` clause
-can now be explcitly ordered by passing a list of 2-tuples::
+can now be explicitly ordered by passing a list of 2-tuples::
from sqlalchemy.dialects.mysql import insert
A series of modernizations to the parameters accepted by the cx_oracle
dialect as well as the URL string:
-* The deprecated paramters ``auto_setinputsizes``, ``allow_twophase``,
+* The deprecated parameters ``auto_setinputsizes``, ``allow_twophase``,
``exclude_setinputsizes`` are removed.
* The value of the ``threaded`` parameter, which has always been defaulted
:class:`.MetaData`.
Since the vast majority of cases that deal with :class:`.Sequence` expect
-that :class:`.Sequence` to be fully "owned" by the assocated :class:`.Table`
+that :class:`.Sequence` to be fully "owned" by the associated :class:`.Table`
and that options like default schema are propagated, setting the
:paramref:`.Sequence.metadata` parameter should be considered a best practice.
objects returned from reflection cannot be always relied upon to produce the identical
DDL as the original Python-defined :class:`.Table` objects. Areas where
this occurs includes server defaults, column-associated sequences and various
-idosyncrasies regarding constraints and datatypes. Server side defaults may
+idiosyncrasies regarding constraints and datatypes. Server side defaults may
be returned with cast directives (typically PostgreSQL will include a ``::<type>``
cast) or different quoting patterns than originally specified.
is a bitwise AND of the value in ``somecolumn``.
When using :meth:`.Operators.op`, the return type of the expression may be important,
-especialy when the operator is used in an expression that will be sent as a result
+especially when the operator is used in an expression that will be sent as a result
column. For this case, be sure to make the type explicit, if not what's
normally expected, using :func:`.type_coerce`::
.. warning::
- The range type DDL support should work with any Postgres DBAPI
+ The range type DDL support should work with any PostgreSQL DBAPI
driver, however the data types returned may vary. If you are using
``psycopg2``, it's recommended to upgrade to version 2.5 or later
before using these column types.
result = conn.execute(stmt, my_param=12)
When the message takes the form "a value is required for bind parameter <x>
-in parameter group <y>", the message is referring to the "executemany" stye
+in parameter group <y>", the message is referring to the "executemany" style
of execution. In this case, the statement is typically an INSERT, UPDATE,
or DELETE and a list of parameters is being passed. In this format, the
statement may be generated dynamically to include parameter positions for
How can I profile a SQLAlchemy powered application?
---------------------------------------------------
-Looking for performance issues typically involves two stratgies. One
+Looking for performance issues typically involves two strategies. One
is query profiling, and the other is code profiling.
Query Profiling
* Use result caching - see :ref:`examples_caching` for an in-depth example
of this.
-* Consider a faster interpreter like that of Pypy.
+* Consider a faster interpreter like that of PyPy.
The output of a profile can be a little daunting but after some
practice they are very easy to read.
SQLAlchemy Core: Total time for 100000 records 0.21024107933 secs
sqlite3: Total time for 100000 records 0.137335062027 sec
-We can reduce the time by a factor of nearly three using recent versions of `Pypy <http://pypy.org/>`_::
+We can reduce the time by a factor of nearly three using recent versions of `PyPy <http://pypy.org/>`_::
SQLAlchemy ORM: Total time for 100000 records 2.39429616928 secs
SQLAlchemy ORM pk given: Total time for 100000 records 1.51412987709 secs
collections, and are designed to have no impact on the primary results of the query.
Since they are anonymously aliased, they cannot be referenced directly.
-For detail on this beahvior, see :ref:`zen_of_eager_loading`.
+For detail on this behavior, see :ref:`zen_of_eager_loading`.
Query has no ``__len__()``, why not?
------------------------------------
* cPython 2.7
* cPython 3.4 and higher
-* `Pypy <http://pypy.org/>`_ 2.1 or greater
+* `PyPy <http://pypy.org/>`_ 2.1 or greater
.. versionchanged:: 1.2
Python 2.7 is now the minimum Python version supported.
---------------
When ``pip`` is available, the distribution can be
-downloaded from Pypi and installed in one step::
+downloaded from PyPI and installed in one step::
pip install SQLAlchemy
suppose it's called ``Child.parents``, SQLAlchemy by default will load in
the ``Child.parents`` collection to locate all ``Parent`` objects, and remove
each row from the "secondary" table which establishes this link. Note that
- this relationship does not need to be bidrectional; SQLAlchemy is strictly
+ this relationship does not need to be bidirectional; SQLAlchemy is strictly
looking at every :func:`.relationship` associated with the ``Child`` object
being deleted.
* A higher performing option here is to use ON DELETE CASCADE directives
=================================
You can use your own types for collections as well. In simple cases,
-inherting from ``list`` or ``set``, adding custom behavior, is all that's needed.
+inheriting from ``list`` or ``set``, adding custom behavior, is all that's needed.
In other cases, special decorators are needed to tell SQLAlchemy more detail
about how the collection operates.
In the case of ``__table_args__`` or ``__mapper_args__``
specified with declarative mixins, you may want to combine
some parameters from several mixins with those you wish to
-define on the class iteself. The
+define on the class itself. The
:class:`.declared_attr` decorator can be used
here to create user-defined collation routines that pull
from multiple collections::
.. seealso::
- :ref:`examples_inheritance` - complete exampes of joined, single and
+ :ref:`examples_inheritance` - complete examples of joined, single and
concrete inheritance
.. _joined_inheritance:
process than that of :class:`.ConcreteBase`, in that the entire mapping
of the base class must be delayed until all the subclasses have been declared.
With a mapping like the above, only instances of ``Manager`` and ``Engineer``
-may be persised; querying against the ``Employee`` class will always produce
+may be persisted; querying against the ``Employee`` class will always produce
``Manager`` and ``Engineer`` objects.
.. seealso::
method :meth:`.Query.with_polymorphic`. This method has the same purpose
as :func:`.orm.with_polymorphic`, except is not as
flexible in its usage patterns in that it only applies to the first entity
-of the :class:`.Query`. It then takes effect for all occurences of
+of the :class:`.Query`. It then takes effect for all occurrences of
that entity, so that the entity (and its subclasses) can be referred to
directly, rather than using an alias object. For simple cases it might be
considered to be more succinct::
that itself uses "with_polymorphic". A particular use case is that of
using selectin loading to load a joined-inheritance subtable, which then
uses "with_polymorphic" to refer to further sub-classes, which may be
-joined- or single-table inheritanace. If we added a class ``VicePresident`` that
+joined- or single-table inheritance. If we added a class ``VicePresident`` that
extends ``Manager`` using single-table inheritance, we could ensure that
a load of ``Manager`` also fully loads ``VicePresident`` subtypes at the same time::
``Writer`` that's associated with a *different* ``Magazine``, the ORM
will overwrite ``Article.magazine_id`` non-deterministically, silently
changing which magazine we refer towards; it may
-also attempt to place NULL into this columnn if we de-associate a
+also attempt to place NULL into this column if we de-associate a
``Writer`` from an ``Article``. The warning lets us know this is the case.
To solve this, we need to break out the behavior of ``Article`` to include
On older versions of SQLite, the above nested right JOIN may be re-rendered
as a nested subquery. Older versions of SQLAlchemy would convert right-nested
-joins into subuqeries in all cases.
+joins into subqueries in all cases.
Joined eager loading and result set batching
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"5" and "7" are the primary key values for the previous two ``User``
objects loaded; after a batch of objects are completely loaded, their primary
key values are injected into the ``IN`` clause for the second SELECT.
-Because the relatonship between ``User`` and ``Address`` provides that the
+Because the relationship between ``User`` and ``Address`` provides that the
primary key values for ``User`` can be derived from ``Address.user_id``, the
statement has no joins or subqueries at all.
Polymorphic Eager Loading
-------------------------
-Specification of polymorpic options on a per-eager-load basis is supported.
+Specification of polymorphic options on a per-eager-load basis is supported.
See the section :ref:`eagerloading_polymorphic_subtypes` for examples
of the :meth:`.PropComparator.of_type` method in conjunction with the
:func:`.orm.with_polymorphic` function.
In the more common case, there are typically base or mixin classes that can be
used to distinguish between operations that are destined for different database
-connections. The :paramref:`.Session.binds` argument can accomodate any
+connections. The :paramref:`.Session.binds` argument can accommodate any
arbitrary Python class as a key, which will be used if it is found to be in the
``__mro__`` (Python method resolution order) for a particular mapped class.
Supposing two declarative bases are representing two different database
perform vastly better than individual statement invocations.
* UPDATE statements can similarly be tailored such that all attributes
- are subject to the SET clase unconditionally, again making it much more
+ are subject to the SET clause unconditionally, again making it much more
likely that ``executemany()`` blocks can be used.
The performance behavior of the bulk routines should be studied using the
which correspond to the :ref:`flush process<session_flushing>`.
The flush is where all the decisions are made about pending changes to
objects and are then emitted out to the database in the form of INSERT,
-UPDATE, and DELETE staetments.
+UPDATE, and DELETE statements.
``before_flush()``
^^^^^^^^^^^^^^^^^^
upon objects to validate their state as well as to compose additional objects
and references before they are persisted. Within this event,
it is **safe to manipulate the Session's state**, that is, new objects
-can be attached to it, objects can be deleted, and indivual attributes
+can be attached to it, objects can be deleted, and individual attributes
on objects can be changed freely, and these changes will be pulled into
the flush process when the event hook completes.
Transaction Events
------------------
-Transaction events allow an application to be notifed when transaction
+Transaction events allow an application to be notified when transaction
boundaries occur at the :class:`.Session` level as well as when the
:class:`.Session` changes the transactional state on :class:`.Connection`
objects.
* :func:`.relationship` attributes configured as "eager loading" via the
:paramref:`~.relationship.lazy` parameter will load in the case of
:meth:`~.Session.refresh`, if either no attribute names are specified, or
- if their names are inclued in the list of attributes to be
+ if their names are included in the list of attributes to be
refreshed.
* Attributes that are configured as :func:`.deferred` will not normally load,
"autocommit" mode is a **legacy mode of use** and should not be
considered for new projects. If autocommit mode is used, it is strongly
- advised that the application at least ensure that tranasction scope
+ advised that the application at least ensure that transaction scope
is made present via the :meth:`.Session.begin` method, rather than
using the session in pure autocommit mode.
Enabling Two-Phase Commit
-------------------------
-For backends which support two-phase operaration (currently MySQL and
+For backends which support two-phase operation (currently MySQL and
PostgreSQL), the session can be instructed to use two-phase commit semantics.
This will coordinate the committing of transactions across databases so that
the transaction is either committed or rolled back in all databases. You can
server. ``server_version_info`` will always return the database
server version information (in this case SQL2005) and not the
compatibility level information. Because of this, if running under
-a backwards compatibility mode SQAlchemy may attempt to use T-SQL
+a backwards compatibility mode SQLAlchemy may attempt to use T-SQL
statements that are unable to be parsed by the database server.
Triggers
`Character set introducers <https://dev.mysql.com/doc/refman/5.7/en/charset-introducer.html>`_ - on the MySQL website
-Ansi Quoting Style
+ANSI Quoting Style
------------------
MySQL features two varieties of identifier "quoting style", one using
MySQL's ON DUPLICATE KEY UPDATE clause allows reference to the row
that would be inserted, via a special function called ``VALUES()``.
- This attribute provides all columns in this row to be referenaceable
+ This attribute provides all columns in this row to be referenceable
such that they will render within a ``VALUES()`` function inside the
ON DUPLICATE KEY UPDATE clause. The attribute is named ``.inserted``
so as not to conflict with the existing :meth:`.Insert.values` method.
Passing a list of 2-tuples indicates that the parameter assignments
in the UPDATE clause should be ordered as sent, in a manner similar
- to that described for the :class:`.Update` contruct overall
+ to that described for the :class:`.Update` construct overall
in :ref:`updates_order_parameters`::
insert().on_duplicate_key_update(
~~~~~~~~~~~~~~~~~
Oracle has a more efficient storage mode for indexes containing lots of
-repeated values. Use the ``oracle_compress`` parameter to turn on key c
-ompression::
+repeated values. Use the ``oracle_compress`` parameter to turn on key
+compression::
Index('my_index', my_table.c.data, oracle_compress=True)
.. versionchanged:: 1.3 Unicode conversion is applied to all string values
by default under python 2. The ``coerce_to_unicode`` now defaults to True
- and can be set to False to disable the Unicode coersion of strings that are
+ and can be set to False to disable the Unicode coercion of strings that are
delivered as VARCHAR2/CHAR/CLOB data.
Users of the cx_Oracle dialect are **strongly encouraged** to read through
cx_Oracle's list of built-in datatype symbols at
http://cx-oracle.readthedocs.io/en/latest/module.html#types.
-Note that in some cases, signficant performance degradation can occur when
+Note that in some cases, significant performance degradation can occur when
using these types vs. not, in particular when specifying ``cx_Oracle.CLOB``.
On the SQLAlchemy side, the :meth:`.DialectEvents.do_setinputsizes` event can
-be used both for runtime visibliity (e.g. logging) of the setinputsizes step as
+be used both for runtime visibility (e.g. logging) of the setinputsizes step as
well as to fully control how ``setinputsizes()`` is used on a per-statement
basis.
"""Return a list of FOREIGN TABLE names.
Behavior is similar to that of :meth:`.Inspector.get_table_names`,
- except that the list is limited to those tables tha report a
+ except that the list is limited to those tables that report a
``relkind`` value of ``f``.
.. versionadded:: 1.0.0
not provide out of the box functionality for translating values between Python
`datetime` objects and a SQLite-supported format. SQLAlchemy's own
:class:`~sqlalchemy.types.DateTime` and related types provide date formatting
-and parsing functionality when SQlite is used. The implementation classes are
+and parsing functionality when SQLite is used. The implementation classes are
:class:`~.sqlite.DATETIME`, :class:`~.sqlite.DATE` and :class:`~.sqlite.TIME`.
These types represent dates and times as ISO formatted strings, which also
nicely support ordering. There's no reliance on typical "libc" internals for
new transaction is to be begun immediately. This may seem to imply
that the SQLite driver would in theory allow only a single filehandle on a
particular database file at any time; however, there are several
-factors both within SQlite itself as well as within the pysqlite driver
+factors both within SQLite itself as well as within the pysqlite driver
which loosen this restriction significantly.
However, no matter what locking modes are used, SQLite will still always
The SQLite database supports transactional :term:`DDL` as well.
In this case, the pysqlite driver is not only failing to start transactions,
-it also is ending any existing transction when DDL is detected, so again,
+it also is ending any existing transaction when DDL is detected, so again,
workarounds are required.
.. warning::
with the name.
:param isolate_multiinsert_groups=True: indicates that multi-valued
- INSERT contructs created using :meth:`.Insert.values` should be
+ INSERT constructs created using :meth:`.Insert.values` should be
handled by returning only the subset of parameters that are local
to the current column default invocation. When ``False``, the
raw parameters of the statement are returned including the
"""
def __init__(self, url, kwargs):
- """Contruct a new :class:`.CreateEnginePlugin`.
+ """Construct a new :class:`.CreateEnginePlugin`.
The plugin object is instantiated individually for each call
to :func:`.create_engine`. A single :class:`.Engine` will be
The remaining fairly common case is that of the textual SQL
that includes at least partial column information; this is when
- we use a :class:`.TextAsFrom` construct. This contruct may have
+ we use a :class:`.TextAsFrom` construct. This construct may have
unordered or ordered column information. In the ordered case, we
merge the cursor.description and the compiled construct's information
positionally, and warn if there are additional description names
def close(self):
"""Close this ResultProxy.
- This closes out the underlying DBAPI cursor corresonding
+ This closes out the underlying DBAPI cursor corresponding
to the statement execution, if one is still present. Note that the
DBAPI cursor is automatically released when the :class:`.ResultProxy`
exhausts all available rows. :meth:`.ResultProxy.close` is generally
class UnreflectableTableError(InvalidRequestError):
- """Table exists but can't be reflectted for some reason.
+ """Table exists but can't be reflected for some reason.
.. versionadded:: 1.2
of type :class:`.AssociationProxy`.
Is assigned to the :attr:`.InspectionAttr.extension_type`
- attibute.
+ attribute.
"""
5. The override logic for many-to-many works the same as that of one-to-many/
many-to-one; the :func:`.generate_relationship` function is called upon
- to generate the strucures and existing attributes will be maintained.
+ to generate the structures and existing attributes will be maintained.
Relationships with Inheritance
------------------------------
function. In practice, the :class:`.AutomapBase` class is always used
as a mixin along with an actual declarative base.
- A new subclassable :class:`.AutomapBase` is typically instantated
+ A new subclassable :class:`.AutomapBase` is typically instantiated
using the :func:`.automap_base` function.
.. seealso::
at class configuration time, it behaves like a declarative mixin
or an ``__abstract__`` base class. Once classes are configured
and mappings are produced, it then gets mapped itself, but
- after all of its decscendants. This is a very unique system of mapping
+ after all of its descendants. This is a very unique system of mapping
not found in any other SQLAlchemy system.
Using this approach, we can specify columns and properties
of type :class:`.hybrid_method`.
Is assigned to the :attr:`.InspectionAttr.extension_type`
- attibute.
+ attribute.
.. seealso::
of type :class:`.hybrid_method`.
Is assigned to the :attr:`.InspectionAttr.extension_type`
- attibute.
+ attribute.
.. seealso::
The ``age`` attribute at the instance level works as before; however
when rendering SQL, PostgreSQL's ``->>`` operator will be used
-for indexed access, instead of the usual index opearator of ``->``::
+for indexed access, instead of the usual index operator of ``->``::
>>> query = session.query(Person).filter(Person.age < 20)
solution for the use case of tracking deep changes to a *recursive*
dictionary structure, such as a JSON structure. To support this use case,
build a subclass of :class:`.MutableDict` that provides appropriate
- coersion to the values placed in the dictionary so that they too are
+ coercion to the values placed in the dictionary so that they too are
"mutable", and emit events up to their parent structure.
.. seealso::
solution for the use case of tracking deep changes to a *recursive*
mutable structure, such as a JSON structure. To support this use case,
build a subclass of :class:`.MutableList` that provides appropriate
- coersion to the values placed in the dictionary so that they too are
+ coercion to the values placed in the dictionary so that they too are
"mutable", and emit events up to their parent structure.
.. versionadded:: 1.1
solution for the use case of tracking deep changes to a *recursive*
mutable structure. To support this use case,
build a subclass of :class:`.MutableSet` that provides appropriate
- coersion to the values placed in the dictionary so that they too are
+ coercion to the values placed in the dictionary so that they too are
"mutable", and emit events up to their parent structure.
.. versionadded:: 1.1
to lessen the impact of this limitation, however this does not take place
for a UNIQUE column.
A future feature will allow the "DELETE before INSERT" behavior to be
- possible, allevating this limitation, though this feature will require
+ possible, alleviating this limitation, though this feature will require
explicit configuration at the mapper level for sets of columns that
are to be handled in this way.
# key situations
if id(original) in _NO_STATE_SYMBOLS:
deleted = ()
- # indicate a "del" operation occured when we don't have
+ # indicate a "del" operation occurred when we don't have
# the previous value as: ([None], (), ())
if id(current) in _NO_STATE_SYMBOLS:
current = None
# ignore the None in any case.
if id(original) in _NO_STATE_SYMBOLS or original is None:
deleted = ()
- # indicate a "del" operation occured when we don't have
+ # indicate a "del" operation occurred when we don't have
# the previous value as: ([None], (), ())
if id(current) in _NO_STATE_SYMBOLS:
current = None
not part of sqlalchemy.ext.
Is assigned to the :attr:`.InspectionAttr.extension_type`
- attibute.
+ attribute.
""",
)
a changing value such as a timestamp, the
:meth:`.AttributeEvents.init_scalar`
event handler can also be used to **set** the newly returned value, so
- that a Core-level default generation function effecively fires off
+ that a Core-level default generation function effectively fires off
only once, but at the moment the attribute is accessed on the
non-persisted object. Normally, no change to the object's state
is made when an uninitialized attribute is accessed (much older
from what was specified as
:paramref:`.relationship.collection_class`, and will always
be empty.
- :param collection_adpater: the :class:`.CollectionAdapter` that will
+ :param collection_adapter: the :class:`.CollectionAdapter` that will
mediate internal access to the collection.
.. versionadded:: 1.0.0 the :meth:`.AttributeEvents.init_collection`
"""
- def dispose_collection(self, target, collection, collection_adpater):
+ def dispose_collection(self, target, collection, collection_adapter):
"""Receive a 'collection dispose' event.
This event is triggered for a collection-based attribute when
non_primary = None
"""Represent ``True`` if this :class:`.Mapper` is a "non-primary"
- mapper, e.g. a mapper that is used only to selet rows but not for
+ mapper, e.g. a mapper that is used only to select rows but not for
persistence management.
This is a *read only* attribute determined during mapper construction.
return PathRegistry.per_mapper(self)
def _configure_inheritance(self):
- """Configure settings related to inherting and/or inherited mappers
+ """Configure settings related to inheriting and/or inherited mappers
being present."""
# a set of all mappers which inherit from this one.
:class:`.Mapper` has several pre-filtered views
of this attribute which limit the types of properties
- returned, inclding :attr:`.synonyms`, :attr:`.column_attrs`,
+ returned, including :attr:`.synonyms`, :attr:`.column_attrs`,
:attr:`.relationships`, and :attr:`.composites`.
.. warning::
additional options, properties, or related mappings before the operation
proceeds.
- * :meth:`.MapperEvents.mapper_configured` - called as each indivudal
+ * :meth:`.MapperEvents.mapper_configured` - called as each individual
:class:`.Mapper` is configured within the process; will include all
mapper state except for backrefs set up by other mappers that are still
to be configured.
propkey_to_col = mapper._propkey_to_col[table]
if bulk:
- # keys here are mapped attrbute keys, so
+ # keys here are mapped attribute keys, so
# look at mapper attribute keys for pk
params = dict(
(propkey_to_col[propkey].key, state_dict[propkey])
has_all_pks = True
if bulk:
- # keys here are mapped attrbute keys, so
+ # keys here are mapped attribute keys, so
# look at mapper attribute keys for pk
pk_params = dict(
(propkey_to_col[propkey]._label, state_dict.get(propkey))
"""MapperProperty implementations.
-This is a private module which defines the behavior of invidual ORM-
+This is a private module which defines the behavior of individual ORM-
mapped attributes.
"""
The :meth:`.Query.yield_per` method **is not compatible
subqueryload eager loading or joinedload eager loading when
using collections**. It is potentially compatible with "select in"
- eager loading, **provided the databse driver supports multiple,
+ eager loading, **provided the database driver supports multiple,
independent cursors** (pysqlite and psycopg2 are known to work,
MySQL and SQL Server ODBC drivers do not).
:param identity_token: identity token that should be used to create
the identity key. Used as is, however overriding subclasses can
repurpose this in order to interpret the value in a special way,
- such as if None then look among multple target tokens.
+ such as if None then look among multiple target tokens.
:param passive: passive load flag passed to
:func:`.loading.get_from_identity`, which impacts the behavior if
the object is found; the object may be validated and/or unexpired
approach to the use case of applying an :func:`.aliased` construct
explicitly throughout a query. Instead of referring to the
:func:`.aliased` construct explicitly,
- :meth:`.Query.select_entity_from` automatically *adapts* all occurences
+ :meth:`.Query.select_entity_from` automatically *adapts* all occurrences
of the entity to the target selectable.
Given a case for :func:`.aliased` such as selecting ``User``
In normal cases, the :paramref:`~.relationship.foreign_keys`
parameter is **not required.** :func:`.relationship` will
automatically determine which columns in the
- :paramref:`~.relationship.primaryjoin` conditition are to be
+ :paramref:`~.relationship.primaryjoin` condition are to be
considered "foreign key" columns based on those
:class:`.Column` objects that specify :class:`.ForeignKey`,
or are otherwise listed as referencing columns in a
not necessary for new applications. The :class:`.Session`
normally handles the work of "begin" transparently, which in
turn relies upon the Python DBAPI to transparently "begin"
- transactions; there is **no need to explcitly begin transactions**
+ transactions; there is **no need to explicitly begin transactions**
when using modern :class:`.Session` programming patterns.
In its default mode of ``autocommit=False``, the
:class:`.Session` does all of its work within
To make a transient object associated with a :class:`.Session`
via :meth:`.Session.enable_relationship_loading` pending, add
it to the :class:`.Session` using :meth:`.Session.add` normally.
- If the object instead represents an existing idenity in the database,
+ If the object instead represents an existing identity in the database,
it should be merged using :meth:`.Session.merge`.
:meth:`.Session.enable_relationship_loading` does not improve
@util.memoized_property
def mapper(self):
- """Return the :class:`.Mapper` used for this mapepd object."""
+ """Return the :class:`.Mapper` used for this mapped object."""
return self.manager.mapper
@property
defaultload("someattr").undefer_group("large_attrs"))
.. versionchanged:: 0.9.0 :func:`.orm.undefer_group` is now specific to a
- particiular entity load path.
+ particular entity load path.
.. seealso::
Unlike the :attr:`._ConnectionRecord.info` dictionary, which is linked
to the lifespan of the DBAPI connection, this dictionary is linked
to the lifespan of the :class:`._ConnectionRecord` container itself
- and will remain persisent throughout the life of the
+ and will remain persistent throughout the life of the
:class:`._ConnectionRecord`.
.. versionadded:: 1.1
connection.execute(drop_spow)
When operating on Table events, the following ``statement``
- string substitions are available::
+ string substitutions are available::
%(table)s - the Table name, with any required quoting applied
%(schema)s - the schema name, with any required quoting applied
automatic resolution of dependency cycles between tables, which
are usually caused by mutually dependent foreign key constraints.
To resolve these cycles, either the
- :paramref:`.ForeignKeyConstraint.use_alter` parameter may be appled
+ :paramref:`.ForeignKeyConstraint.use_alter` parameter may be applied
to those constraints, or use the
:func:`.sql.sort_tables_and_constraints` function which will break
out foreign key constraints involved in cycles separately.
if True, this parameter will be treated as an "expanding" parameter
at execution time; the parameter value is expected to be a sequence,
rather than a scalar value, and the string SQL statement will
- be transformed on a per-execution basis to accomodate the sequence
+ be transformed on a per-execution basis to accommodate the sequence
with a variable number of parameter slots passed to the DBAPI.
This is to allow statement caching to be used in conjunction with
an IN clause.
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.startswith.autoescape` flag
- may be set to ``True`` to apply escaping to occurences of these
+ may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.startswith.escape` parameter will establish
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.endswith.autoescape` flag
- may be set to ``True`` to apply escaping to occurences of these
+ may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.endswith.escape` parameter will establish
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.contains.autoescape` flag
- may be set to ``True`` to apply escaping to occurences of these
+ may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.contains.escape` parameter will establish
* Oracle - renders ``CONTAINS(x, y)``
* other backends may provide special implementations.
* Backends without any special implementation will emit
- the operator as "MATCH". This is compatible with SQlite, for
+ the operator as "MATCH". This is compatible with SQLite, for
example.
"""
m1 = MetaData()
- user = Table('user', m1, Column('id', Integer, priamry_key=True))
+ user = Table('user', m1, Column('id', Integer, primary_key=True))
m2 = MetaData()
user_copy = user.tometadata(m2)
event.listen(self, "after_parent_attach", fn)
def copy(self, **kw):
- """Create a copy of this ``Column``, unitialized.
+ """Create a copy of this ``Column``, uninitialized.
This is used in ``Table.tometadata``.
automatic resolution of dependency cycles between tables, which
are usually caused by mutually dependent foreign key constraints.
To resolve these cycles, either the
- :paramref:`.ForeignKeyConstraint.use_alter` parameter may be appled
+ :paramref:`.ForeignKeyConstraint.use_alter` parameter may be applied
to those constraints, or use the
:func:`.schema.sort_tables_and_constraints` function which will
break out foreign key constraints involved in cycles separately.
the existing bind on this ``MetaData``, if any.
:param schema:
- Optional, query and reflect tables from an alterate schema.
+ Optional, query and reflect tables from an alternate schema.
If None, the schema associated with this :class:`.MetaData`
is used, if any.
level function as well as the :meth:`.FromClause.lateral` method available
on all :class:`.FromClause` subclasses.
- While LATERAL is part of the SQL standard, curently only more recent
+ While LATERAL is part of the SQL standard, currently only more recent
PostgreSQL versions provide support for this keyword.
.. versionadded:: 1.1
When columns are omitted based on foreign key, the referred-to
column is the one that's kept. When columns are omitted based on
- WHERE eqivalence, the first column in the columns clause is the
+ WHERE equivalence, the first column in the columns clause is the
one that's kept.
:param only_synonyms: when True, limit the removal of columns
be much longer due to decimal inaccuracy, and most floating point
database types don't have a notion of "scale", so by default the
float type looks for the first ten decimal places when converting.
- Specfiying this value will override that length. Types which
+ Specifying this value will override that length. Types which
do include an explicit ".scale" value, such as the base
:class:`.Numeric` as well as the MySQL float types, will use the
value of ".scale" as the default for decimal_return_scale, if not
.. versionadded:: 0.9.0
When using the ``Numeric`` type, care should be taken to ensure
- that the asdecimal setting is apppropriate for the DBAPI in use -
+ that the asdecimal setting is appropriate for the DBAPI in use -
when Numeric applies a conversion from Decimal->float or float->
Decimal, this conversion incurs an additional performance overhead
for all result columns received.
be much longer due to decimal inaccuracy, and most floating point
database types don't have a notion of "scale", so by default the
float type looks for the first ten decimal places when converting.
- Specfiying this value will override that length. Note that the
+ Specifying this value will override that length. Note that the
MySQL float types, which do include "scale", will use "scale"
as the default for decimal_return_scale, if not otherwise specified.
Index operations return an expression object whose type defaults to
:class:`.JSON` by default, so that further JSON-oriented instructions may
be called upon the result type. Note that there are backend-specific
- idiosyncracies here, including that the PostgreSQL database does not
+ idiosyncrasies here, including that the PostgreSQL database does not
generally compare a "json" to a "json" structure without type casts. These
- idiosyncracies can be accommodated in a backend-neutral way by making
+ idiosyncrasies can be accommodated in a backend-neutral way by making
explicit use of the :func:`.cast` and :func:`.type_coerce` constructs.
Comparison of specific index elements of a :class:`.JSON` object to other
objects works best if the **left hand side is CAST to a string** and the
.. note::
- The "evaulates none" flag does **not** apply to a value
+ The "evaluates none" flag does **not** apply to a value
of ``None`` passed to :paramref:`.Column.default` or
:paramref:`.Column.server_default`; in these cases, ``None``
still means "no default".
where it can be consumed by schema comparison tools such as
Alembic autogenerate.
- A future release of SQLAlchemy will potentially impement this method
+ A future release of SQLAlchemy will potentially implement this method
for builtin types as well.
The function should return True if this type is equivalent to the
and optional ON clause, return a list of integer indexes from the
clauses list indicating the clauses that can be joined from.
- The presense of an "onclause" indicates that at least one clause can
+ The presence of an "onclause" indicates that at least one clause can
definitely be joined from; if the list of clauses is of length one
and the onclause is given, returns that index. If the list of clauses
is more than length one, and the onclause is given, attempts to locate
kw["mysql_engine"] = "MyISAM"
# Apply some default cascading rules for self-referential foreign keys.
- # MySQL InnoDB has some issues around seleting self-refs too.
+ # MySQL InnoDB has some issues around selecting self-refs too.
if exclusions.against(config._current, "firebird"):
table_name = args[0]
unpack = config.db.dialect.identifier_preparer.unformat_identifiers
fetched_pk = config.db.scalar(select([table.c.id]))
eq_(fetched_pk, pk)
- def test_autoincrement_on_insert_implcit_returning(self):
+ def test_autoincrement_on_insert_implicit_returning(self):
config.db.execute(self.tables.autoinc_pk.insert(), data="some data")
self._assert_round_trip(self.tables.autoinc_pk, config.db)
def warn_limited(msg, args):
- """Issue a warning with a paramterized string, limiting the number
+ """Issue a warning with a parameterized string, limiting the number
of registrations.
"""
def quoted_token_parser(value):
- """Parse a dotted identifier with accomodation for quoted names.
+ """Parse a dotted identifier with accommodation for quoted names.
Includes support for SQL-style double quotes as a literal character.
def test_pjoin_compile(self):
"""test that remote_side columns in the secondary join table
- arent attempted to be matched to the target polymorphic
+ aren't attempted to be matched to the target polymorphic
selectable"""
class BaseItem(object):
polymorphic_identity=0,
)
- def test_polymorpic_on_not_in_with_poly(self):
+ def test_polymorphic_on_not_in_with_poly(self):
t2, t1 = self.tables.t2, self.tables.t1
Parent = self.classes.Parent
)
def test_plain_descriptor(self):
- """test that descriptors prevent inheritance from propigating
+ """test that descriptors prevent inheritance from propagating
properties to subclasses."""
class Base(object):
assert sess.query(Sub).one().data == "im the data"
def test_custom_descriptor(self):
- """test that descriptors prevent inheritance from propigating
+ """test that descriptors prevent inheritance from propagating
properties to subclasses."""
class MyDesc(object):
# scalar attributes have their own load
self.assert_sql_count(testing.db, go, 1)
- # ideally, this was already loaded, but we arent
+ # ideally, this was already loaded, but we aren't
# doing it that way right now
# self.assert_sql_count(testing.db, go, 0)
# trans is now closed
eq_(trans._state, _session.CLOSED)
- # outermost transction is new
+ # outermost transaction is new
is_not_(session.transaction, trans)
# outermost is active
@property
def no_quoting_special_bind_names(self):
- """Target database will quote bound paramter names, doesn't support
+ """Target database will quote bound parameter names, doesn't support
EXPANDING"""
return skip_if(["oracle"])
)
f = sa.select([func.length("abcdef")], bind=db).scalar()
f2 = sa.select([func.length("abcdefghijk")], bind=db).scalar()
- # TODO: engine propigation across nested functions not working
+ # TODO: engine propagation across nested functions not working
currenttime = func.trunc(
currenttime, sa.literal_column("'DAY'"), bind=db, type_=sa.Date
)
"""These tests are all about the "join rewriting" feature built
-to support SQLite's lack of right-nested joins. SQlite as of
+to support SQLite's lack of right-nested joins. SQLite as of
version 3.7.16 no longer has this limitation.
"""
eq_(expr.clauses[1].type._type_affinity, String)
eq_(expr.clauses[2].type._type_affinity, LargeBinary()._type_affinity)
- def test_type_coersion_on_eq(self):
+ def test_type_coercion_on_eq(self):
a, b, c = (
column("a", Integer),
column("b", String),
expr = t1 == (3, "hi", "there")
self._assert_types(expr.right)
- def test_type_coersion_on_in(self):
+ def test_type_coercion_on_in(self):
a, b, c = (
column("a", Integer),
column("b", String),
return bindparam(None, "x", type_=col.type, unique=True)
return None
- # ensure we evaulate the expression so that we can see
+ # ensure we evaluate the expression so that we can see
# the clone resets this info
stmt.compile()