Commit Graph

1183 Commits

Author SHA1 Message Date
Mike Bayer 341a52015b - native unicode expectations are too difficult to maintain
w/ the number of drivers /DBURIs /  python versions

(cherry picked from commit d18d6d9baf)
2016-01-23 14:34:08 -05:00
Mike Bayer 107f1f47b9 - add a forwards-test here as well
(cherry picked from commit 38958f7b3f)
2016-01-21 15:33:18 -05:00
Mike Bayer 9cc769ac40 - documenation updates to clarify specific SQLite versions
that have problems with right-nested joins and UNION column keys;
references #3633 references #3634.   backport from 1.1 to 0.9
announcing 1.1 as where these behaviors will be retired based
on version-specific checks
- fix test_resultset so that it passes when SQLite 3.10.0 is
present, references #3633

(cherry picked from commit 89fa08792e)
2016-01-21 15:23:56 -05:00
Mike Bayer 6ba8382fa8 - Fixed 1.0 regression where the eager fetch of cursor.rowcount was
no longer called for an UPDATE or DELETE statement emitted via plain
text or via the :func:`.text` construct, affecting those drivers
that erase cursor.rowcount once the cursor is closed such as SQL
Server ODBC and Firebird drivers.
fixes #3622

(cherry picked from commit 197ffa2be2)
2016-01-05 10:26:12 -05:00
Mike Bayer 7184e69e27 - add some more oracle skips
(cherry picked from commit c42725ed54)
2015-12-14 20:22:21 -05:00
Mike Bayer a6387b0df8 - Fixed bug in :meth:.Update.return_defaults which would cause all
insert-default holding columns not otherwise included in the SET
clause (such as primary key cols) to get rendered into the RETURNING
even though this is an UPDATE.

- Major fixes to the :paramref:`.Mapper.eager_defaults` flag, this
flag would not be honored correctly in the case that multiple
UPDATE statements were to be emitted, either as part of a flush
or a bulk update operation.  Additionally, RETURNING
would be emitted unnecessarily within update statements.

fixes #3609

(cherry picked from commit 0e4c4d7efc)
2015-12-14 17:30:42 -05:00
Mike Bayer 6d44b01263 - Fixed issue within the :meth:.Insert.from_select construct whereby
the :class:`.Select` construct would have its ``._raw_columns``
collection mutated in-place when compiling the :class:`.Insert`
construct, when the target :class:`.Table` has Python-side defaults.
The :class:`.Select` construct would compile standalone with the
erroneous column present subsequent to compilation of the
:class:`.Insert`, and the the :class:`.Insert` statement itself would
fail on a second compile attempt due to duplicate bound parameters.
fixes #3603

(cherry picked from commit e57bf79616)
2015-12-09 18:15:57 -05:00
Mike Bayer 7b5fd86a42 - Fixed bug where CREATE TABLE with a no-column table, but a constraint
such as a CHECK constraint would render an erroneous comma in the
definition; this scenario can occur such as with a Postgresql
INHERITS table that has no columns of its own.
fixes #3598

(cherry picked from commit 9695faf329)
2015-12-01 19:04:48 -05:00
Mike Bayer d2d60acdcb - Added support for parameter-ordered SET clauses in an UPDATE
statement.  This feature is available by passing the
:paramref:`~.sqlalchemy.sql.expression.update.preserve_parameter_order`
flag either to the core :class:`.Update` construct or alternatively
adding it to the :paramref:`.Query.update.update_args` dictionary at
the ORM-level, also passing the parameters themselves as a list of 2-tuples.
Thanks to Gorka Eguileor for implementation and tests.
adapted from pullreq github:200

(cherry picked from commit c90f0a49f3)
2015-11-28 14:30:58 -05:00
Mike Bayer 3dcbee5f51 - fix bool test
(cherry picked from commit 1704eacf24)
2015-09-27 12:13:48 -04:00
Mike Bayer 28b2a0c986 - break out critical aspects of test_query into their own tests
finally, test_resultset and test_insert_exec.   Update all
idioms within these.

(cherry picked from commit a8e1d33ae5)
2015-09-27 12:10:27 -04:00
Mike Bayer 161209c70a - Fixed regression in 1.0-released default-processor for multi-VALUES
insert statement, 🎫`3288`, where the column type for the
default-holding column would not be propagated to the compiled
statement in the case where the default was being used,
leading to bind-level type handlers not being invoked.
fixes #3520

(cherry picked from commit c39ff9978d)
2015-08-31 11:30:21 -04:00
Mike Bayer c7312cc508 - changelog for #3459, fixes #3459
- test for .cast() method has no good place now except for
test_cast in test_compiler.py
2015-07-19 17:56:18 -04:00
Mike Bayer 1c65ddee24 Merge branch 'bb_issue_3459' of https://bitbucket.org/xflr6/sqlalchemy into pr56 2015-07-19 17:51:26 -04:00
Mike Bayer ddad190529 - Fixed regression where new methods on :class:.ResultProxy used
by the ORM :class:`.Query` object (part of the performance
enhancements of 🎫`3175`) would not raise the "this result
does not return rows" exception in the case where the driver
(typically MySQL) fails to generate cursor.description correctly;
an AttributeError against NoneType would be raised instead.
fixes #3481
2015-07-19 16:32:31 -04:00
Mike Bayer c00ef11a0c - pg8000 very annoyingly complaining here, use total literal 2015-07-19 16:01:02 -04:00
Mike Bayer d7ceb63c94 - Fixed regression where :meth:.ResultProxy.keys would return
un-adjusted internal symbol names for "anonymous" labels, which
are the "foo_1" types of labels we see generated for SQL functions
without labels and similar.  This was a side effect of the
performance enhancements implemented as part of references #918.
fixes #3483
2015-07-19 12:20:00 -04:00
Mike Bayer 3cfe3fd81d - Fixed bug where coersion of literal `True or False` constant
in conjunction with :func:`.and_` or :func:`.or_` would fail
with an AttributeError.
fixes #3490
2015-07-19 10:27:33 -04:00
Mike Bayer 41aead96cd - Fixed potential issue where a custom subclass
of :class:`.FunctionElement` or other column element that incorrectly
states 'None' or any other invalid object as the ``.type``
attribute will report this exception instead of recursion overflow.
fixes #3485
2015-07-19 10:00:13 -04:00
Mike Bayer 480dad983c - fix these two tests 2015-07-17 11:08:42 -04:00
Mike Bayer b89ca77dca Merge remote-tracking branch 'origin/pr/188' into pr188 2015-07-17 10:44:05 -04:00
Dan Gittik ae6fd1c389 Added test for modulo operator. 2015-07-17 02:28:23 +03:00
jakeogh 66b9a71ce7 add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUE 2015-06-27 20:49:46 +00:00
jakeogh 85ebe01349 add NO MINVALUE and NO MAXVALUE support to Sequence() 2015-06-27 18:48:46 +00:00
jakeogh ad7caa6988 add MAXVALUE support to Sequence() 2015-06-27 18:37:09 +00:00
jakeogh f31c288b65 add MINVALUE support to Sequence() 2015-06-27 08:40:44 +00:00
Sebastian Bank 84e813aee4 add ClauseElement.cast() shortcut-method 2015-06-19 17:37:21 +02:00
Mike Bayer a9030d0241 - Fixed a bug where clause adaption as applied to a :class:.Label
object would fail to accommodate the labeled SQL expression
in all cases, such that any SQL operation that made use of
:meth:`.Label.self_group` would use the original unadapted
expression.  One effect of this would be that an ORM :func:`.aliased`
construct would not fully accommodate attributes mapped by
:obj:`.column_property`, such that the un-aliased table could
leak out when the property were used in some kinds of SQL
comparisons.
fixes #3445
2015-06-09 23:39:14 -04:00
Mike Bayer eb1bb84fbc - Added official support for a CTE used by the SELECT present
inside of :meth:`.Insert.from_select`.  This behavior worked
accidentally up until 0.9.9, when it no longer worked due to
unrelated changes as part of 🎫`3248`.   Note that this
is the rendering of the WITH clause after the INSERT, before the
SELECT; the full functionality of CTEs rendered at the top
level of INSERT, UPDATE, DELETE is a new feature targeted for a
later release.
fixes #3418
2015-05-08 12:37:55 -04:00
Mike Bayer 77db0ef6ac - Fixed bug in enhanced constraint-attachment logic introduced in
🎫`3341` where in the unusual case of a constraint that refers
to a mixture of :class:`.Column` objects and string column names
at the same time, the auto-attach-on-column-attach logic will be
skipped; for the constraint to be auto-attached in this case,
all columns must be assembled on the target table up front.
Added a new section to the migration document regarding the
original feature as well as this change.
fixes #3411
2015-05-02 10:27:03 -04:00
Mike Bayer ac52239b32 - Fixed bug where the truncation of long labels in SQL could produce
a label that overlapped another label that is not truncated; this
because the length threshhold for truncation was greater than
the portion of the label that remains after truncation.  These
two values have now been made the same; label_length - 6.
The effect here is that shorter column labels will be "truncated"
where they would not have been truncated before.
fixes #3396
2015-04-28 16:02:59 -04:00
Mike Bayer f9275198c3 - Fixed a regression that was incorrectly fixed in 1.0.0b4
(hence becoming two regressions); reports that
SELECT statements would GROUP BY a label name and fail was misconstrued
that certain backends such as SQL Server should not be emitting
ORDER BY or GROUP BY on a simple label name at all; when in fact,
we had forgotten that 0.9 was already emitting ORDER BY on a simple
label name for all backends, as described in :ref:`migration_1068`,
as 1.0 had rewritten this logic as part of 🎫`2992`.

In 1.0.2, the bug is fixed both that SQL Server, Firebird and others
will again emit ORDER BY on a simple label name when passed a
:class:`.Label` construct that is expressed in the columns clause,
and no backend will emit GROUP BY on a simple label name in this case,
as even Postgresql can't reliably do GROUP BY on a simple name
in every case.
fixes #3338, fixes #3385
2015-04-24 17:04:35 -04:00
Mike Bayer dd4240e43b - Fixed support for "literal_binds" mode when using limit/offset
with Firebird, so that the values are again rendered inline when
this is selected.  Related to 🎫`3034`.
fixes #3381
2015-04-23 12:07:56 -04:00
Mike Bayer 39978060b0 - repair a regression caused by #3282, where we no longer were
applying any topological sort to tables on SQLite.  See the
changelog for details, but we now continue to sort
tables for SQLite on DROP, prohibit the sort from considering
alter, and only warn if we encounter an unresolvable cycle, in
which case, then we forego the ordering.  use_alter as always
is used to break such a cycle.
fixes #3378
2015-04-22 14:14:11 -04:00
Mike Bayer 3e80d628bd - Fixed issue where a straight SELECT EXISTS query would fail to
assign the proper result type of Boolean to the result mapping, and
instead would leak column types from within the query into the
result map.  This issue exists in 0.9 and earlier as well, however
has less of an impact in those versions.  In 1.0, due to #918
this becomes a regression in that we now rely upon the result mapping
to be very accurate, else we can assign result-type processors to
the wrong column.   In all versions, this issue also has the effect
that a simple EXISTS will not apply the Boolean type handler, leading
to simple 1/0 values for backends without native boolean instead of
True/False.   The fix includes that an EXISTS columns argument
will be anon-labeled like other column expressions; a similar fix is
implemented for pure-boolean expressions like ``not_(True())``.
fixes #3372
2015-04-20 19:21:00 -04:00
Mike Bayer 623e5b2149 Merge remote-tracking branch 'origin/pr/163' into pr163 2015-04-12 14:56:15 -04:00
Mike Bayer fc702c9d80 - adjust for "0" 2015-04-12 12:59:31 -04:00
Mike Bayer 55c26710a1 - Fixed issue where a :class:.MetaData object that used a naming
convention would not properly work with pickle.  The attribute was
skipped leading to inconsistencies and failures if the unpickled
:class:`.MetaData` object were used to base additional tables
from.
fixes #3362
2015-04-10 11:20:14 -04:00
Mike Bayer ffec6ab936 - add test support for MySQLdb with use_unicode=1 or using mysqlclient on py3k 2015-04-08 17:23:26 -04:00
Mike Bayer 07153dc092 - ensure that the keys we put into the parameters dictionary
for an insert from select are the string names, and not
the Column objects.  The MSSQL dialect in particular relies upon
checking for these keys in params to know if identity insert
should be on.  references #3360
2015-04-08 12:14:56 -04:00
Mike Bayer ad7cb2ebd3 Merge branch 'bb_issue_3084' of https://bitbucket.org/xflr6/sqlalchemy into pr47 2015-04-03 17:59:40 -04:00
Mike Bayer 5ed49f38c3 - The warning emitted by the unicode type for a non-unicode type
has been liberalized to warn for values that aren't even string
values, such as integers; previously, the updated warning system
of 1.0 made use of string formatting operations which
would raise an internal TypeError.   While these cases should ideally
raise totally, some backends like SQLite and MySQL do accept them
and are potentially in use by legacy code, not to mention that they
will always pass through if unicode conversion is turned off
for the target backend.
fixes #3346
2015-03-31 15:10:42 -04:00
Mike Bayer bdcaa0f6ca - The "auto-attach" feature of constraints such as :class:.UniqueConstraint
and :class:`.CheckConstraint` has been further enhanced such that
when the constraint is associated with non-table-bound :class:`.Column`
objects, the constraint will set up event listeners with the
columns themselves such that the constraint auto attaches at the
same time the columns are associated with the table.  This in particular
helps in some edge cases in declarative but is also of general use.
fixes #3341
2015-03-24 10:55:29 -04:00
Mike Bayer 04545727d4 - Fixed bug in new "label resolution" feature of 🎫2992 where
a label that was anonymous, then labeled again with a name, would
fail to be locatable via a textual label.  This situation occurs
naturally when a mapped :func:`.column_property` is given an
explicit label in a query.
fixes #3340
2015-03-23 12:33:48 -04:00
Mike Bayer db853306c4 - Fixed unicode support for PyMySQL when using an "executemany"
operation with unicode parameters.  SQLAlchemy now passes both
the statement as well as the bound parameters as unicode
objects, as PyMySQL generally uses string interpolation
internally to produce the final statement, and in the case of
executemany does the "encode" step only on the final statement.
fixes #3337
2015-03-22 19:25:13 -04:00
Mike Bayer c09c21c9f3 - Fixed bug in new "label resolution" feature of 🎫2992 where
the string label placed in the order_by() or group_by() of a statement
would place higher priority on the name as found
inside the FROM clause instead of a more locally available name
inside the columns clause.
fixes #3335
2015-03-21 13:12:15 -04:00
Eric Streeper e467db9edb PEP8 cleanup in /test/sql 2015-03-18 21:38:57 -07:00
Mike Bayer b7e151ac5c - The "auto close" for :class:.ResultProxy is now a "soft" close.
That is, after exhausing 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
for fetchmany and fetchall).   Only if :meth:`.ResultProxy.close`
is called explicitly will these methods raise the "result is closed"
error.
fixes #3330 fixes #3329
2015-03-17 12:32:33 -04:00
Mike Bayer 71b8df2e53 - The Postgresql :class:.postgresql.ENUM type will emit a
DROP TYPE instruction when a plain ``table.drop()`` is called,
assuming the object is not associated directly with a
:class:`.MetaData` object.   In order to accomodate the use case of
an enumerated type shared between multiple tables, the type should
be associated directly with the :class:`.MetaData` object; in this
case the type will only be created at the metadata level, or if
created directly.  The rules for create/drop of
Postgresql enumerated types have been highly reworked in general.
fixes #3319
2015-03-11 11:41:52 -04:00
Mike Bayer 4ba715f80a - rename _select_wraps
- replace force_result_map with a mini-API for nested result sets, add
coverage
2015-03-08 12:33:38 -04:00