summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - some cleanups in compiler.pyMike Bayer2015-08-181-50/+32
|
* - as the Concatenable mixin was changed to support calling down toMike Bayer2015-08-181-1/+1
| | | | | | | | | | | | "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_3514 None-handling branchMike Bayer2015-08-171-0/+13
| | | | | | | | | | | | | | | | - Fixes to the ORM and to the postgresql JSON type regarding the ``None`` constant in conjunction with the Postgresql :class:`.JSON` type. When the :paramref:`.JSON.none_as_null` flag is left at its default value of ``False``, the ORM will now correctly insert the Json "'null'" string into the column whenever the value on the ORM object is set to the value ``None`` or when the value ``None`` is used with :meth:`.Session.bulk_insert_mappings`, **including** if the column has a default or server default on it. This makes use of a new type-level flag "evaluates_none" which is implemented by the JSON type based on the none_as_null flag. fixes #3514 - Added a new constant :attr:`.postgresql.JSON.NULL`, indicating that the JSON NULL value should be used for a value regardless of other settings. part of fixes #3514
* - merge of ticket_3499 indexed access branchMike Bayer2015-08-175-5/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-121-1/+17
| | | | | | | | | 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
* Remove useless codepr/191Leonardo Rochael Almeida2015-08-061-3/+0
| | | `to_unicode` variable was created but was not used.
* - fix typo in suffix_with() docs, fixes #3502Mike Bayer2015-07-291-1/+1
|
* - changelog for #3459, fixes #3459Mike Bayer2015-07-191-1/+4
| | | | | - 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 :meth:`.ResultProxy.keys` would returnMike Bayer2015-07-191-3/+0
| | | | | | | | | | | | | | | | 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-2/+5
| | | | | | | | | | | | 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-1/+8
| | | | | | | | | | | | | | 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
* | Merge remote-tracking branch 'origin/pr/188' into pr188Mike Bayer2015-07-171-0/+8
|\ \
| * | Added support for reflected modulo operator.Dan Gittik2015-07-171-0/+8
| | |
* | | - version specs for new Sequence argumentsMike Bayer2015-07-171-0/+15
| | | | | | | | | | | | - changelog for pullreq github:186
* | | Merge remote-tracking branch 'origin/pr/186' into pr186Mike Bayer2015-07-172-2/+50
|\ \ \ | |/ / |/| |
| * | add CYCLE support to Sequence() and docstrings for NO MINVALUE and NO MAXVALUEpr/186jakeogh2015-06-272-4/+31
| | |
| * | add NO MINVALUE and NO MAXVALUE support to Sequence()jakeogh2015-06-272-2/+6
| | |
| * | add MAXVALUE support to Sequence()jakeogh2015-06-272-3/+12
| | |
| * | add MINVALUE support to Sequence()jakeogh2015-06-272-2/+10
| |/
* | - try to note under insert.values(), if you needMike Bayer2015-07-081-3/+7
|/ | | | | | "multiple parameter sets" there is a much more common case which works equally well for INSERT/UPDATE/DELETE e.g. executemany(). reference #3476
* - Repaired the :class:`.ExcludeConstraint` construct to support commonMike Bayer2015-06-161-8/+20
| | | | | | | features that other objects like :class:`.Index` now do, that the column expression may be specified as an arbitrary SQL expression such as :obj:`.cast` or :obj:`.text`. fixes #3454
* - Fixed a bug where clause adaption as applied to a :class:`.Label`Mike Bayer2015-06-091-1/+2
| | | | | | | | | | | | 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-1/+15
| | | | | | | | | | | 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-8/+16
| | | | | | | | | | | :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
* - Added a placeholder method :meth:`.TypeEngine.compare_against_backend`Mike Bayer2015-04-301-0/+27
| | | | | | which is now consumed by Alembic migrations as of 0.7.6. User-defined types can implement this method to assist in the comparison of a type against one reflected from the database.
* - Fixed bug where the truncation of long labels in SQL could produceMike Bayer2015-04-281-1/+1
| | | | | | | | | | 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
* - altered part of the use contract first set up in #2992; weMike Bayer2015-04-271-1/+4
| | | | | | | | now skip textual label references when copying ORDER BY elements to the joined-eager-load subquery, as we can't know that these expressions are compatible with this placement; either because they are meant for text(), or because they refer to label names already stated and aren't bound to a table. fixes #3392
* - Fixed regression due to :ticket:`3282` where the ``tables`` collectionMike Bayer2015-04-271-6/+13
| | | | | | | | | | | | | | | | passed as a keyword argument to the :meth:`.DDLEvents.before_create`, :meth:`.DDLEvents.after_create`, :meth:`.DDLEvents.before_drop`, and :meth:`.DDLEvents.after_drop` events would no longer be a list of tables, but instead a list of tuples which contained a second entry with foreign keys to be added or dropped. As the ``tables`` collection, while documented as not necessarily stable, has come to be relied upon, this change is considered a regression. Additionally, in some cases for "drop", this collection would be an iterator that would cause the operation to fail if prematurely iterated. The collection is now a list of table objects in all cases and test coverage for the format of this collection is now added. fixes #3391
* - Fixed a regression that was incorrectly fixed in 1.0.0b4Mike Bayer2015-04-242-3/+14
| | | | | | | | | | | | | | | | | | (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-2/+2
| | | | | | 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-14/+32
| | | | | | | | | | 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-203-12/+36
| | | | | | | | | | | | | | | | 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
* - Fixed issue where a :class:`.MetaData` object that used a namingMike Bayer2015-04-101-1/+4
| | | | | | | | 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
* - ensure that the keys we put into the parameters dictionaryMike Bayer2015-04-081-2/+4
| | | | | | | 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-032-3/+5
|\
| * make sort_tables order deterministicSebastian Bank2015-03-072-3/+5
| |
* | Fix typospr/165Ernest Walzel2015-03-261-1/+1
| | | | | | | | | | agaisnt -> against 'a Alias' -> 'an Alias'
* | - The "auto-attach" feature of constraints such as :class:`.UniqueConstraint`Mike Bayer2015-03-241-17/+37
| | | | | | | | | | | | | | | | | | | | 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-232-2/+3
| | | | | | | | | | | | | | | | 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 bug in new "label resolution" feature of :ticket:`2992` whereMike Bayer2015-03-211-1/+2
| | | | | | | | | | | | | | | | 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
* | - remove now-misleading comment that SQLite doesn't support MATCH,Mike Bayer2015-03-141-2/+4
| | | | | | | | since they've apparently added something for it
* | - try to document how to get columns from constraints.Mike Bayer2015-03-121-0/+8
| | | | | | | | | | unfortunately Sphinx refuses to work correctly for the columns attribute so we just add a lame message to contains_column().
* | - The Postgresql :class:`.postgresql.ENUM` type will emit aMike Bayer2015-03-112-24/+44
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | - copyright 2015Mike Bayer2015-03-1019-19/+19
| |
* | - pick around gaining modest dings in callcounts here and thereMike Bayer2015-03-092-3/+16
| |
* | - random performance whacking vs. 0.9, in particular we have to watchMike Bayer2015-03-081-15/+14
| | | | | | | | for the slots-based __getattr__ thing getting hit
* | - rename _select_wrapsMike Bayer2015-03-081-13/+33
| | | | | | | | | | - replace force_result_map with a mini-API for nested result sets, add coverage
* | fooMike Bayer2015-03-081-16/+5
| |