Commit Graph

10896 Commits

Author SHA1 Message Date
Mike Bayer ab1eb81092 Use regexp to parse cx_oracle version string
Fixed bug in cx_Oracle dialect where version string parsing would
fail for cx_Oracle version 6.0b1 due to the "b" character.  Version
string parsing is now via a regexp rather than a simple split.

Change-Id: I2af7172b0d7184e3ea3bd051e9fa8d6ca2a571cd
Fixes: #3975
(cherry picked from commit 50484eda7787c3e83c9c88c1841fc63b348ca23c)
2017-05-09 12:18:10 -04:00
Mike Bayer e3035661f4 Protect against cls weakref becoming None
Protected against testing "None" as a class in the case where
declarative classes are being garbage collected and new
automap prepare() operations are taking place concurrently, very
infrequently hitting a weakref that has not been fully acted upon
after gc.

Change-Id: I32e1dfc5ac46bac4127fe808cfd18368e2fad9dd
(cherry picked from commit 22570c3181)
2017-05-08 18:37:40 -04:00
LunarShaddow 2d5477e12b Break the lines to fit pdf and fix another broken syntax
(cherry picked from commit 3d19fb6d53)

Change-Id: I17334d7673c645505af4eaaf2112544f2fa5e625
2017-05-08 17:58:33 -04:00
Mike Bayer aec264ba31 - add 1.2 forwards-port version
Change-Id: I093f3939be8858a2f327c5ee5884b9629b216855
2017-05-08 17:54:32 -04:00
Ben Fagin a950b2cc05 fixes a typo
(cherry picked from commit 6224df56a6)
2017-05-08 16:21:43 -04:00
Mike Bayer 62313dc4e5 - big rewrite of the Sequence documentation:
1. Sequence should be associated with MetaData always,
except in the really weird case someone is sharing a Sequence
among multiple metadatas.  Make this a "best practice", end the
confusion of #3951, #3979

2. "optional" is not a thing people use, trim this way down

3. remove confusing language

Change-Id: Iab5aec319da2582092fe2615ee50430f76441aff
2017-05-05 15:06:19 -04:00
Mike Bayer 8d916e7a59 - add another note re: 339e2c13b0
which clarifies that ForeignKey circumvents this logic as a
"convenience".   issue #3978 is updated to address trying to make
this consistent.

Change-Id: I089acaa89f11b7a6310c2bf32916e26eb62ab9c0
(cherry picked from commit 8f830d78ba)
2017-05-05 10:40:01 -04:00
Mike Bayer abaa6da7a0 - add a note to MetaData.schema indicating that the Table
will be cataloged in the .tables collection with its fully
qualified name.   Fixes #3978

Change-Id: I65fa063918efc22658e93c39a0680cb83553dec8
(cherry picked from commit 339e2c13b0)
2017-05-05 09:20:09 -04:00
Mike Bayer ca7f83bf9b test / document postgresql_ops against a labeled expression
Since postgresql_ops explicitly states that it expects
string keys, to apply to a function call or expression one
needs to give the SQL expression a label that can be referred
to by name in the dictionary.   test / document this.

Change-Id: I4bc4ade46dac27f9c1b92e7823433292beab97b9
Fixes: #3970
(cherry picked from commit 029d0f7538)
2017-04-24 16:22:37 -04:00
Mike Bayer ab409348c0 - edits
Change-Id: If2445c4cbcd7eb18e06823e8821940a391890979
(cherry picked from commit 6560bf82f3)
2017-04-22 16:43:49 -04:00
Mike Bayer 710553188c - update relationship loader docs, backport from
1.2 wip

Change-Id: I0a3c4a0166f6feed23a021723233d281fad597ec
(cherry picked from commit e53009e253)
2017-04-21 18:21:41 -04:00
Jonathan Suever 2c8be2edd6 Fix of minor typo in the UnmappedInstanceError message
(cherry picked from commit 90c72c31a5)
2017-04-17 15:35:08 -04:00
Mike Bayer ad073bd168 - remove errant doctest comment
Change-Id: Idb8520ff807074ceca36645728a63b79d1cdff6c
(cherry picked from commit c2834f9298)
2017-04-17 15:33:27 -04:00
Mike Bayer 1729f4a051 Remove MySQL UTC_TIMESTAMP rule
Removed an ancient and unnecessary intercept of the UTC_TIMESTAMP
MySQL function, which was getting in the way of using it with a
parameter.

Change-Id: I6e6b52c051418bcb9d31987e78299310810cb78d
Fixes: #3966
(cherry picked from commit c0b85ad6ad)
2017-04-13 10:44:00 -04:00
Mike Bayer f1ffcc717f Consider mysql partition options separately from other table options
Move down all the PARTITION, SUBPARTITION options
into a separate segment so that they come out at the
end of CREATE TABLE after the table options.

Change-Id: Iaa1c823848c93680ca22d72bda1b7c49742b9060
Fixes: #3961
(cherry picked from commit 93b11905e5)
2017-04-06 12:35:34 -04:00
Mike Bayer da28e8f723 - 1.1.10 prep
Change-Id: Ieec7379402ce35d3d0c15a5e6b5056e9d83071cf
2017-04-06 09:54:48 -04:00
Mike Bayer e48a9e78be - 1.1.9 rel_1_1_9 2017-04-04 14:03:01 -04:00
Mike Bayer 10a3004f2c Add much more detail to the "unhashable types" change
Change-Id: I34cbf54913b81ef2ae8b2e60f03feb78601460e5
Fixes: 3958
2017-04-04 13:09:55 -04:00
mike bayer 02023ac46e Merge "Ensure we check that SQL expression has an .info attribute" into rel_1_1 2017-04-04 10:09:01 -04:00
Bertrand Janin 803a52436f Fix typo.
(cherry picked from commit 6524838950)
2017-04-04 10:04:20 -04:00
Mike Bayer 1ad5ad165d Ensure we check that SQL expression has an .info attribute
Fixed regression released in 1.1.8 due to 🎫`3950` where the
deeper search for information about column types in the case of a
"schema type" or a :class:`.TypeDecorator` would produce an attribute
error if the mapping also contained a :obj:`.column_property`.

Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931
Fixes: #3956
(cherry picked from commit d13734add3)
2017-04-04 09:07:14 -04:00
Mike Bayer f52fb5282a ResultProxy won't autoclose connection until state flag is set
Changed the mechanics of :class:`.ResultProxy` to unconditionally
delay the "autoclose" step until the :class:`.Connection` is done
with the object; in the case where Postgresql ON CONFLICT with
RETURNING returns no rows, autoclose was occurring in this previously
non-existent use case, causing the usual autocommit behavior that
occurs unconditionally upon INSERT/UPDATE/DELETE to fail.

Change-Id: I235a25daf4381b31f523331f810ea04450349722
Fixes: #3955
(cherry picked from commit 8ee363e4917b0dcd64a83b6d26e465c9e61e0ea5)
2017-04-03 21:12:39 -04:00
Mike Bayer 2281ac7f1c - fix version identifier
Change-Id: If3bad7b79a61be6e421883727a430bdc5d9745db
2017-04-03 17:31:30 -04:00
Mike Bayer 6896d2bb47 Return self when Variant.coerce_compared_value would return impl
Fixed regression released in 1.1.5 due to 🎫`3859` where
adjustments to the "right-hand-side" evaluation of an expression
based on :class:`.Variant` to honor the underlying type's
"right-hand-side" rules caused the :class:`.Variant` type
to be inappropriately lost, in those cases when we *do* want the
left-hand side type to be transferred directly to the right hand side
so that bind-level rules can be applied to the expression's argument.

Change-Id: Ia54dbbb19398549d654b74668753c4152599d900
Fixes: #3952
(cherry picked from commit 6d7d48af0d)
2017-04-01 13:48:25 -04:00
Mike Bayer 0d1383fc1b - 1.1.9 prep
Change-Id: I89f403529969f703f3b153fda317f163137686db
2017-04-01 11:37:13 -04:00
Mike Bayer f7ea0149fc - 1.1.8 rel_1_1_8 2017-03-31 14:24:06 -04:00
Mike Bayer 502a46b64e Track SchemaEventTarget types in as_mutable()
Fixed bug in :mod:`sqlalchemy.ext.mutable` where the
:meth:`.Mutable.as_mutable` method would not track a type that had
been copied using :meth:`.TypeEngine.copy`.  This became more of
a regression in 1.1 compared to 1.0 because the :class:`.TypeDecorator`
class is now a subclass of :class:`.SchemaEventTarget`, which among
other things indicates to the parent :class:`.Column` that the type
should be copied when the :class:`.Column` is.  These copies are
common when using declarative with mixins or abstract classes.

Change-Id: Ib04df862c58263185dbae686c548fea3e12c46f1
Fixes: #3950
(cherry picked from commit 07b63894cb)
2017-03-30 17:52:56 -04:00
Malaclypse The Younger 23585b842c Add bindparams support for baked Result count() method
Added support for bound parameters, e.g. those normally set up
via :meth:`.Query.params`, to the :meth:`.baked.Result.count`
method.  Previously, support for parameters were omitted. Pull request
courtesy Pat Deegan.

Change-Id: I8c33548cf2a483699767e459731694c8cadebff6
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/350
(cherry picked from commit 74f6c21747)
2017-03-30 12:34:41 -04:00
Ihor Kalnytskyi e851bf436b Docs/faq/performance
Some updates for FAQ/Performance documentation page:

* Fix typo in testing script.
* Populate testing script with one more way to achieve higher performance.

See commit messages for details.

Change-Id: Id6fbf328164b14b3b58ca9616b103a35e72f7b8f
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/345
(cherry picked from commit a4c17c1397)
2017-03-30 10:16:35 -04:00
Sean McCully 6d13f0ace3 Support Postgresql development version numbers
Added support for parsing the Postgresql version string for
a development version like "PostgreSQL 10devel".  Pull request
courtesy Sean McCully.

Change-Id: I7bc18bc4d290349c23e9796367b7d694d0873096
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/351
(cherry picked from commit a86764d99b)
2017-03-29 16:18:48 -04:00
Mike Bayer 9aebc08f82 - 1.1.8 prep
Change-Id: I36f2f2be3ce49931bb9fc304b5abfd67824290cb
2017-03-29 16:15:39 -04:00
Mike Bayer dca69f3f1e - 1.1.7 rel_1_1_7 2017-03-27 17:25:25 -04:00
Mike Bayer 6bdfeb73f2 Allow aliased() to be passed to Query.select_entity_from().
An :func:`.aliased()` construct can now be passed to the
:meth:`.Query.select_entity_from` method.   Entities will be pulled
from the selectable represented by the :func:`.aliased` construct.
This allows special options for :func:`.aliased` such as
:paramref:`.aliased.adapt_on_names` to be used in conjunction with
:meth:`.Query.select_entity_from`.

Additionally rewrote the docstring for :meth:`.Query.select_entity_from`,
including starting with explicit use of :func:`.aliased` as the
usual idiomatic pattern.  An example using text().columns() is added
as well as the use case from 🎫`3933` using name matching.

Change-Id: If7e182965236993064a2a086e3b6d55a4f097ca8
Fixes: #3933
(cherry picked from commit b5577b6fb3decda0293399a630e6601e86e08726)
2017-03-27 14:39:29 -04:00
mike bayer c531deda10 Merge "Add safe_reraise() + warnings only to Connection._autorollback" into rel_1_1 2017-03-27 11:34:55 -04:00
Bertrand Janin 4145f914bc Fix a title typo
Utilites -> Utilities
(cherry picked from commit 5df05d1670)
2017-03-27 11:31:03 -04:00
Mike Bayer 08f42a915a Add safe_reraise() + warnings only to Connection._autorollback
Added an exception handler that will warn for the "cause" exception on
Py2K when the "autorollback" feature of :class:`.Connection` itself
raises an exception. In Py3K, the two exceptions are naturally reported
by the interpreter as one occurring during the handling of the other.
This is continuing with the series of changes for rollback failure
handling that were last visited as part of 🎫`2696` in 1.0.12.

Change-Id: I600ba455a14ebaea27c6189889181f97c632f179
Fixes: #3946
(cherry picked from commit c0a224aba3)
2017-03-27 11:15:41 -04:00
Mike Bayer 7a6cc6e897 Pre-load alias.c within JoinedEagerLoader cached AliasedClass
Fixed a race condition which could occur under threaded environments
as a result of the caching added via 🎫`3915`.   An internal
collection of ``Column`` objects could be regenerated on an alias
object inappropriately, confusing a joined eager loader when it
attempts to render SQL and collect results and resulting in an
attribute error.   The collection is now generated up front before
the alias object is cached and shared among threads.

Change-Id: I97d5b205992d38af8d2b4307178a15c086ef9993
Fixes: #3947
(cherry picked from commit f214f4d4f4)
2017-03-25 22:18:51 -04:00
Mike Bayer 5b34463cb6 Use config.db global opts as defaults for all testing_engine()
Some options need to be passed to engines in all cases,
such as currently the oracle 12516 workaround.   make sure
calls to testing_engine also set up the dictionary with
defaults even if options is passed.    not clear if this affects
other backends yet.

Change-Id: I5a1f7634e4ce5af6fe55dc21a24db6afacd19bb7
(cherry picked from commit 28edc2604a)
2017-03-22 10:42:29 -04:00
Jamie Alessio d574156430 Fix typos ('expicit' -> 'explicit')
(cherry picked from commit 3771af0af4)
2017-03-18 14:58:10 -04:00
Paul Brown 2a0ab7c8da fix pep8 errors in association example
(cherry picked from commit 6aad7fb4217ef294f68f693be5b3137c28184949)
2017-03-18 14:42:00 -04:00
Paul Brown 8ab8b6c78c fix pep8 errors in adjacency_list example
(cherry picked from commit ff230f1862892eb2b479ed85e6858a82159b435f)
2017-03-18 14:41:50 -04:00
Mike Bayer f89319d49a - re-set no ad-hoc-engines for oracle, previously low-connections
disabled this

Change-Id: I3ceceaea7a3969248121ff4dc97c11296831fc99
(cherry picked from commit 4a886e519f)
2017-03-13 18:09:08 -04:00
Mike Bayer 957089f79e Repair _execute_scalar for WITH_UNICODE mode
cx_Oracle 5.3 seems to code this flag ON now, so
remove the warning and ensure WITH_UNICODE handling works.

Additionally, the XE setup on jenkins is having more
problems here, in particular low-connections mode is
causing cx_Oracle to fail more frequently now.  Turning
off low-connections fixes those but then we get the
TNS errors, so adding an emergency "retry" flag that
is not yet a feature available to users.  Real world
applications are not dropping/creating thousands of
tables the way our test suite is.

Change-Id: Ie95b0e697276c404d3264c2e624e870463d966d6
Fixes: #3937
2017-03-13 14:34:43 -04:00
Mike Bayer 7402f97d2b - set correct gitreview branch
Change-Id: I5e158062946fdc96340d27078a2866d99208f5a0
2017-03-13 12:31:44 -04:00
Mike Bayer 75ceae6ea6 - add a note as to why we have this very complicated Annotated
system

Change-Id: I7d4048b92fcd3a7c7630c43aa9390d983f447c0a
2017-03-09 17:38:21 -05:00
Mike Bayer c04870ba7b Allow SchemaType and Variant to work together
Added support for the :class:`.Variant` and the :class:`.SchemaType`
objects to be compatible with each other.  That is, a variant
can be created against a type like :class:`.Enum`, and the instructions
to create constraints and/or database-specific type objects will
propagate correctly as per the variant's dialect mapping.

Also added testing for some potential double-event scenarios
on TypeDecorator but it seems usually this doesn't occur.

Change-Id: I4a7e7c26b4133cd14e870f5bc34a1b2f0f19a14a
Fixes: #2892
2017-03-07 16:24:18 -05:00
Mike Bayer 9e62715973 Repair missing "checkfirst" for test suite
the test_metadata tests trigger the before_create dispatch without
the checkfirst flag.  Postgresql backend should be able to
tolerate this.

Change-Id: Ife497cc3a4eb2812462116f94aad732864225f3f
2017-03-07 15:00:18 -05:00
Mike Bayer 74bec18c2a - document ForeignKeyConstraint columns / elements, fixes #2904
Change-Id: Ia50a3100d1bd88020c30224932b16aeadd7f4c75
2017-03-07 14:54:53 -05:00
mike bayer b54cefc379 Merge "Don't cache savepoint identifiers" 2017-03-06 19:12:40 -05:00
Mike Bayer f4c4f784cd Don't cache savepoint identifiers
Fixed bug in compiler where the string identifier of a savepoint would
be cached in the identifier quoting dictionary; as these identifiers
are arbitrary, a small memory leak could occur if a single
:class:`.Connection` had an unbounded number of savepoints used,
as well as if the savepoint clause constructs were used directly
with an unbounded umber of savepoint names.   The memory leak does
**not** impact the vast majority of cases as normally the
:class:`.Connection`, which renders savepoint names with a simple
counter starting at "1", is used on a per-transaction or
per-fixed-number-of-transactions basis before being discarded.

The savepoint name in virtually all cases does not require quoting
at all, however to support potential third party use cases
the "check for quotes needed" logic is retained, at a small
performance cost.   Uncondtionally quoting the name is another
option, but this would turn the name into a case sensitive name
which runs the risk of poor interactions with existing deployments
that may be looking at these names in other contexts.

Change-Id: I6b53c96abf7fdf1840592bbca5da81347911844c
Fixes: #3931
2017-03-06 17:20:06 -05:00