summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - Postgres: Do not prefix table with schema in: "FOR UPDATE of <table>"pr/216Diana Clarke2015-11-241-2/+2
| | | | | | | | | | | | For example, this query: SELECT s1.users.name FROM s1.users FOR UPDATE OF s1.users should actually be: SELECT s1.users.name FROM s1.users FOR UPDATE OF users fixes #3573
* - fix missing argument in TypeDecorator.copy(), fixes #3584, references #2919Mike Bayer2015-11-131-2/+2
|
* - correct the commit from ref #3582 to refer to the correct sub-elementMike Bayer2015-11-111-1/+1
|
* - Fixed bug where the "single table inheritance" criteria would beMike Bayer2015-11-111-0/+15
| | | | | | | added onto the end of a query in some inappropriate situations, such as when querying from an exists() of a single-inheritance subclass. fixes #3582
* Merge branch 'pr204'Mike Bayer2015-10-291-2/+3
|\
| * - convert wrap_callable() to a general purpose update_wrapper-likeMike Bayer2015-10-291-2/+2
| | | | | | | | | | | | function; the caller still passes in the "wrapper" - move tests for wrap_callable() to be generic util tests - changelog for pullreq github:204
| * - wrap ColumnDefault empty arg callables like functools.wraps, setting ↵pr/204Martin J. Hsu2015-10-151-2/+3
| | | | | | | | __name__, __doc__, and __module__
* | - add a JSON warning for coerce_compared_valueMike Bayer2015-10-281-0/+20
| |
* | - open up autoincrement for columns that have a default; autoinc is usuallyMike Bayer2015-10-081-37/+25
| | | | | | | | "auto" now so True can indicate the dialect would support this
* | - The system by which a :class:`.Column` considers itself to be anMike Bayer2015-10-073-42/+199
|/ | | | | | | | | | | | | | | | | "auto increment" column has been changed, such that autoincrement is no longer implicitly enabled for a :class:`.Table` that has a composite primary key. In order to accommodate being able to enable autoincrement for a composite PK member column while at the same time maintaining SQLAlchemy's long standing behavior of enabling implicit autoincrement for a single integer primary key, a third state has been added to the :paramref:`.Column.autoincrement` parameter ``"auto"``, which is now the default. fixes #3216 - The MySQL dialect no longer generates an extra "KEY" directive when generating CREATE TABLE DDL for a table using InnoDB with a composite primary key with AUTO_INCREMENT on a column that isn't the first column; to overcome InnoDB's limitation here, the PRIMARY KEY constraint is now generated with the AUTO_INCREMENT column placed first in the list of columns.
* - Added a new type-level modifier :meth:`.TypeEngine.evaluates_none`Mike Bayer2015-09-191-4/+61
| | | | | | | | | | | | | which indicates to the ORM that a positive set of None should be persisted as the value NULL, instead of omitting the column from the INSERT statement. This feature is used both as part of the implementation for :ticket:`3514` as well as a standalone feature available on any type. fixes #3250 - add new documentation section illustrating the "how to force null" use case of #3250 - alter our change from #3514 so that the class-level flag is now called "should_evaluate_none"; so that "evaluates_none" is now a generative method.
* - The :func:`.type_coerce` construct is now a fully fledged CoreMike Bayer2015-09-164-63/+109
| | | | | | | | | | | 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-311-0/+1
| | | | | | | | 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-1/+14
| | | | | | | | | | | 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
* - add a postgresql-specific form of array_agg() that injects theMike Bayer2015-08-271-2/+9
| | | | ARRAY type, references #3132
* - Added support for "set-aggregate" functions of the formticket_3516Mike Bayer2015-08-265-24/+296
| | | | | | | | | | | ``<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-0/+22
| | | | | | | 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-258-7/+405
| | | | | | - 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/+6
| | | | by mock and other __getattr__ impostors
* - Added new checks for the common error case of passing mapped classesMike Bayer2015-08-225-10/+25
| | | | | | or mapped instances into contexts where they are interpreted as SQL bound parameters; a new exception is raised for this. fixes #3321
* - 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