summaryrefslogtreecommitdiff
path: root/test/sql
Commit message (Collapse)AuthorAgeFilesLines
* - wrap ColumnDefault empty arg callables like functools.wraps, setting ↵pr/204Martin J. Hsu2015-10-151-0/+61
| | | | __name__, __doc__, and __module__
* - The :func:`.type_coerce` construct is now a fully fledged CoreMike Bayer2015-09-162-2/+68
| | | | | | | | | | | expression element which is late-evaluated at compile time. Previously, the function was only a conversion function which would handle different expression inputs by returning either a :class:`.Label` of a column-oriented expression or a copy of a given :class:`.BindParameter` object, which in particular prevented the operation from being logically maintained when an ORM-level expression transformation would convert a column to a bound parameter (e.g. for lazy loading). fixes #3531
* - Fixed regression in 1.0-released default-processor for multi-VALUESMike Bayer2015-08-312-16/+52
| | | | | | | | insert statement, :ticket:`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
* - The :class:`.TypeDecorator` type extender will now work in conjunctionMike Bayer2015-08-271-8/+2
| | | | | | | | | | | with a :class:`.SchemaType` implementation, typically :class:`.Enum` or :class:`.Boolean` with regards to ensuring that the per-table events are propagated from the implementation type to the outer type. These events are used to ensure that the constraints or Postgresql types (e.g. ENUM) are correctly created (and possibly dropped) along with the parent table. fixes #2919
* - Added support for "set-aggregate" functions of the formticket_3516Mike Bayer2015-08-262-17/+112
| | | | | | | | | | | ``<function> WITHIN GROUP (ORDER BY <criteria>)``, using the method :class:`.FunctionElement.within_group`. A series of common set-aggregate functions with return types derived from the set have been added. This includes functions like :class:`.percentile_cont`, :class:`.dense_rank` and others. fixes #1370 - make sure we use func.name for all _literal_as_binds in functions.py so we get consistent naming behavior for parameters.
* - Added support for the SQL-standard function :class:`.array_agg`,Mike Bayer2015-08-261-2/+10
| | | | | | | which automatically returns an :class:`.Array` of the correct type and supports index / slice operations. As arrays are only supported on Postgresql at the moment, only actually works on Postgresql. fixes #3132
* - build out a new base type for Array, as well as new any/all operatorsMike Bayer2015-08-252-5/+220
| | | | | | - any/all work for Array as well as subqueries, accepted by MySQL - Postgresql ARRAY now subclasses Array - fixes #3516
* - repair the inspection hook in sqltypes to not be fooledMike Bayer2015-08-221-1/+9
| | | | by mock and other __getattr__ impostors
* - Added new checks for the common error case of passing mapped classesMike Bayer2015-08-221-2/+23
| | | | | | or mapped instances into contexts where they are interpreted as SQL bound parameters; a new exception is raised for this. fixes #3321
* - as the Concatenable mixin was changed to support calling down toMike Bayer2015-08-181-1/+55
| | | | | | | | | | | | "super" instead of hardcoding to "self.type" for the default return value, the base Comparator was returning other_comparator.type. It's not clear what the rationale for this was, though in theory the base Comparator should possibly even throw an exception if the two types aren't the same (or of the same affinity?) . - mysql.SET was broken on this because the bitwise version adds "0" to the value to force an integer within column_expression, we are doing type_coerces here now in any case so that there is no type ambiguity for this operation
* - merge of ticket_3499 indexed access branchMike Bayer2015-08-172-2/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The "hashable" flag on special datatypes such as :class:`.postgresql.ARRAY`, :class:`.postgresql.JSON` and :class:`.postgresql.HSTORE` is now set to False, which allows these types to be fetchable in ORM queries that include entities within the row. fixes #3499 - The Postgresql :class:`.postgresql.ARRAY` type now supports multidimensional indexed access, e.g. expressions such as ``somecol[5][6]`` without any need for explicit casts or type coercions, provided that the :paramref:`.postgresql.ARRAY.dimensions` parameter is set to the desired number of dimensions. fixes #3487 - The return type for the :class:`.postgresql.JSON` and :class:`.postgresql.JSONB` when using indexed access has been fixed to work like Postgresql itself, and returns an expression that itself is of type :class:`.postgresql.JSON` or :class:`.postgresql.JSONB`. Previously, the accessor would return :class:`.NullType` which disallowed subsequent JSON-like operators to be used. part of fixes #3503 - The :class:`.postgresql.JSON`, :class:`.postgresql.JSONB` and :class:`.postgresql.HSTORE` datatypes now allow full control over the return type from an indexed textual access operation, either ``column[someindex].astext`` for a JSON type or ``column[someindex]`` for an HSTORE type, via the :paramref:`.postgresql.JSON.astext_type` and :paramref:`.postgresql.HSTORE.text_type` parameters. also part of fixes #3503 - The :attr:`.postgresql.JSON.Comparator.astext` modifier no longer calls upon :meth:`.ColumnElement.cast` implicitly, as PG's JSON/JSONB types allow cross-casting between each other as well. Code that makes use of :meth:`.ColumnElement.cast` on JSON indexed access, e.g. ``col[someindex].cast(Integer)``, will need to be changed to call :attr:`.postgresql.JSON.Comparator.astext` explicitly. This is part of the refactor in references #3503 for consistency in operator use.
* - The behavior of the :func:`.union` construct and related constructsMike Bayer2015-08-122-4/+83
| | | | | | | | | such as :meth:`.Query.union` now handle the case where the embedded SELECT statements need to be parenthesized due to the fact that they include LIMIT, OFFSET and/or ORDER BY. These queries **do not work on SQLite**, and will fail on that backend as they did before, but should now work on all other backends. fixes #2528
* - changelog for #3459, fixes #3459Mike Bayer2015-07-192-7/+2
| | | | | - test for .cast() method has no good place now except for test_cast in test_compiler.py
* Merge branch 'bb_issue_3459' of https://bitbucket.org/xflr6/sqlalchemy into pr56Mike Bayer2015-07-191-0/+7
|\
| * add ClauseElement.cast() shortcut-methodSebastian Bank2015-06-191-0/+7
| |
* | - Fixed regression where new methods on :class:`.ResultProxy` usedMike Bayer2015-07-191-2/+10
| | | | | | | | | | | | | | | | | | by the ORM :class:`.Query` object (part of the performance enhancements of :ticket:`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
* | - pg8000 very annoyingly complaining here, use total literalMike Bayer2015-07-191-1/+2
| |
* | - Fixed regression where :meth:`.ResultProxy.keys` would returnMike Bayer2015-07-191-5/+94
| | | | | | | | | | | | | | | | 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
* | - Fixed bug where coersion of literal ``True`` or ``False`` constantMike Bayer2015-07-191-0/+58
| | | | | | | | | | | | in conjunction with :func:`.and_` or :func:`.or_` would fail with an AttributeError. fixes #3490
* | - Fixed potential issue where a custom subclassMike Bayer2015-07-191-2/+14
| | | | | | | | | | | | | | 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
* | - fix these two testsMike Bayer2015-07-171-2/+2
| |
* | Merge remote-tracking branch 'origin/pr/188' into pr188Mike Bayer2015-07-171-0/+3
|\ \
| * | Added test for modulo operator.pr/188Dan Gittik2015-07-171-0/+3
| |/
* | add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-271-0/+6
| |
* | add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-271-0/+12
| |
* | add MAXVALUE support to Sequence()jakeogh2015-06-271-1/+8
| |
* | add MINVALUE support to Sequence()jakeogh2015-06-271-0/+5
|/
* - Fixed a bug where clause adaption as applied to a :class:`.Label`Mike Bayer2015-06-091-0/+21
| | | | | | | | | | | | 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
* - Added official support for a CTE used by the SELECT presentMike Bayer2015-05-081-0/+35
| | | | | | | | | | | 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 :ticket:`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
* - Fixed bug in enhanced constraint-attachment logic introduced inMike Bayer2015-05-021-0/+59
| | | | | | | | | | | :ticket:`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
* - Fixed bug where the truncation of long labels in SQL could produceMike Bayer2015-04-281-22/+45
| | | | | | | | | | 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
* - Fixed a regression that was incorrectly fixed in 1.0.0b4Mike Bayer2015-04-241-0/+13
| | | | | | | | | | | | | | | | | | (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 :ticket:`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
* - Fixed support for "literal_binds" mode when using limit/offsetMike Bayer2015-04-231-3/+3
| | | | | | with Firebird, so that the values are again rendered inline when this is selected. Related to :ticket:`3034`. fixes #3381
* - repair a regression caused by #3282, where we no longer wereMike Bayer2015-04-221-78/+276
| | | | | | | | | | 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
* - Fixed issue where a straight SELECT EXISTS query would fail toMike Bayer2015-04-202-4/+33
| | | | | | | | | | | | | | | | 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
* Merge remote-tracking branch 'origin/pr/163' into pr163Mike Bayer2015-04-126-9/+3
|\
| * PEP8 cleanup in /test/sqlEric Streeper2015-03-186-9/+3
| |
* | - adjust for "0"Mike Bayer2015-04-121-1/+3
| |
* | - Fixed issue where a :class:`.MetaData` object that used a namingMike Bayer2015-04-101-0/+13
| | | | | | | | | | | | | | | | 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
* | - add test support for MySQLdb with use_unicode=1 or using mysqlclient on py3kMike Bayer2015-04-081-0/+6
| |
* | - ensure that the keys we put into the parameters dictionaryMike Bayer2015-04-081-1/+8
| | | | | | | | | | | | | | 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
* | Merge branch 'bb_issue_3084' of https://bitbucket.org/xflr6/sqlalchemy into pr47Mike Bayer2015-04-031-0/+15
|\ \
| * | make sort_tables order deterministicSebastian Bank2015-03-071-0/+15
| | |
* | | - The warning emitted by the unicode type for a non-unicode typeMike Bayer2015-03-311-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | - The "auto-attach" feature of constraints such as :class:`.UniqueConstraint`Mike Bayer2015-03-241-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | - Fixed bug in new "label resolution" feature of :ticket:`2992` whereMike Bayer2015-03-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | | - Fixed unicode support for PyMySQL when using an "executemany"Mike Bayer2015-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | - Fixed bug in new "label resolution" feature of :ticket:`2992` whereMike Bayer2015-03-211-0/+14
| |/ |/| | | | | | | | | | | | | 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
* | - The "auto close" for :class:`.ResultProxy` is now a "soft" close.Mike Bayer2015-03-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* | - The Postgresql :class:`.postgresql.ENUM` type will emit aMike Bayer2015-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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