summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
Commit message (Collapse)AuthorAgeFilesLines
* - type expressions invoke in SQL, but are only for the benefit of columnsMike Bayer2012-09-031-8/+6
| | | | | | delivered to a result set. therefore these expressions should only be rendered for those columns that are being delivered to the result, thereby preventing the expression from stacking onto itself within nesting scenarios.
* - repair type expressions for columns when we aren't using ↵Mike Bayer2012-09-011-2/+5
| | | | | | select.apply_labels(), label should be the column name.
* - [feature] Reworked the startswith(), endswith(),Mike Bayer2012-08-271-1/+45
| | | | | | | | | | | | contains() operators to do a better job with negation (NOT LIKE), and also to assemble them at compilation time so that their rendered SQL can be altered, such as in the case for Firebird STARTING WITH [ticket:2470] - [feature] firebird - The "startswith()" operator renders as "STARTING WITH", "~startswith()" renders as "NOT STARTING WITH", using FB's more efficient operator. [ticket:2470]
* - more oracle tweaks for returning; the method here is still kind of brittle ↵Mike Bayer2012-08-251-1/+3
| | | | | | and might have issues with pks, multiple function calls
* a few oracle fixesMike Bayer2012-08-251-2/+3
|
* - [bug] Fixed bug whereby usage of a UNIONMike Bayer2012-08-221-7/+11
| | | | | | | | or similar inside of an embedded subquery would interfere with result-column targeting, in the case that a result-column had the same ultimate name as a name inside the embedded UNION. [ticket:2552]
* - [bug] Fixed cextension bug whereby theMike Bayer2012-08-221-29/+35
| | | | | | | | | | | | | | | | | | | "ambiguous column error" would fail to function properly if the given index were a Column object and not a string. Note there are still some column-targeting issues here which are fixed in 0.8. [ticket:2553] - find more cases where column targeting is being inaccurate, add more information to result_map to better differentiate "ambiguous" results from "present" or "not present". In particular, result_map is sensitive to dupes, even though no error is raised; the conflicting columns are added to the "obj" member of the tuple so that the two are both directly accessible in the result proxy - handwringing over the damn "name fallback" thing in results. can't really make it perfect yet - fix up oracle returning clause. not sure why its guarding against labels, remove that for now and see what the bot says.
* - MySQL's update does work. add some logic to compiler to convert from ORM ↵Mike Bayer2012-08-201-3/+7
| | | | column to Table column
* - [feature] The Core oeprator system now includesMike Bayer2012-08-201-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the `getitem` operator, i.e. the bracket operator in Python. This is used at first to provide index and slice behavior to the Postgresql ARRAY type, and also provides a hook for end-user definition of custom __getitem__ schemes which can be applied at the type level as well as within ORM-level custom operator schemes. Note that this change has the effect that descriptor-based __getitem__ schemes used by the ORM in conjunction with synonym() or other "descriptor-wrapped" schemes will need to start using a custom comparator in order to maintain this behavior. - [feature] postgresql.ARRAY now supports indexing and slicing. The Python [] operator is available on all SQL expressions that are of type ARRAY; integer or simple slices can be passed. The slices can also be used on the assignment side in the SET clause of an UPDATE statement by passing them into Update.values(); see the docs for examples. - [feature] Added new "array literal" construct postgresql.array(). Basically a "tuple" that renders as ARRAY[1,2,3].
* - [feature] The prefix_with() method is now availableMike Bayer2012-08-191-12/+32
| | | | | | | | on each of select(), insert(), update(), delete(), all with the same API, accepting multiple prefix calls, as well as a "dialect name" so that the prefix can be limited to one kind of dialect. [ticket:2431]
* - fix the labeled column with column_expression() issue, finishes [ticket:1534]Mike Bayer2012-08-181-2/+9
| | | | | | | | | | | - epic documentation sweep for new operator system, making ORM links consistent and complete, full documentation and examples for type/SQL expression feature - type_coerce() explicitly accepts BindParamClause objects - change UserDefinedType to coerce the other side to itself by default as this is much more likely what's desired - make coerce_compared_type() fully public on all types - have profiling run the test no matter what so that the test_zoomarks don't fail when callcounts are missing
* - [feature] To complement [ticket:2547], typesMike Bayer2012-08-171-48/+88
| | | | | | | | | | | | | | | | can now provide "bind expressions" and "column expressions" which allow compile-time injection of SQL expressions into statements on a per-column or per-bind level. This is to suit the use case of a type which needs to augment bind- and result- behavior at the SQL level, as opposed to in the Python level. Allows for schemes like transparent encryption/ decryption, usage of Postgis functions, etc. [ticket:1534] - update postgis example fully. - still need to repair the result map propagation here to be transparent for cases like "labeled column".
* - fix concat() operator, testsMike Bayer2012-08-141-29/+58
| | | | | | | | - [feature] Custom unary operators can now be used by combining operators.custom_op() with UnaryExpression(). - clean up the operator dispatch system and make it more consistent. This does change the compiler contract for custom ops.
* - [feature] Revised the rules used to determineMike Bayer2012-07-221-7/+8
| | | | | | | | | | | | the operator precedence for the user-defined operator, i.e. that granted using the ``op()`` method. Previously, the smallest precedence was applied in all cases, now the default precedence is zero, lower than all operators except "comma" (such as, used in the argument list of a ``func`` call) and "AS", and is also customizable via the "precedence" argument on the ``op()`` method. [ticket:2537]
* - a big renaming of all the _Underscore classes to haveMike Bayer2012-07-171-7/+7
| | | | | | plain names. The old names are still defined for backwards compatibility. - _BindParamClause renamed to BindParameter
* - [bug] Fixed more un-intuitivenesses in CTEsMike Bayer2012-07-101-143/+174
| | | | | | | | | | | | | | | | which prevented referring to a CTE in a union of itself without it being aliased. CTEs now render uniquely on name, rendering the outermost CTE of a given name only - all other references are rendered just as the name. This even includes other CTE/SELECTs that refer to different versions of the same CTE object, such as a SELECT or a UNION ALL of that SELECT. We are somewhat loosening the usual link between object identity and lexical identity in this case. A true name conflict between two unrelated CTEs now raises an error.
* add 2.5 compat for next()Mike Bayer2012-06-251-1/+1
|
* - move cte tests into their own test/sql/test_cte.pyMike Bayer2012-06-251-16/+36
| | | | | | | | | | - rework bindtemplate system of "numbered" params by applying the numbers last, as we now need to generate these out of order in some cases - add positional assertion to assert_compile - add new cte_positional collection to track bindparams generated within cte visits; splice this onto the beginning of self.positiontup at cte render time, [ticket:2521]
* absolute imports in core, sqlMike Bayer2012-06-231-4/+4
|
* - [bug] quoting is applied to the column namesMike Bayer2012-06-211-2/+5
| | | | | | | inside the WITH RECURSIVE clause of a common table expression according to the quoting rules for the originating Column. [ticket:2512]
* - [feature] Added "MATCH" clause to ForeignKey,Mike Bayer2012-06-211-22/+44
| | | | | | | | | | | | | | ForeignKeyConstraint, courtesy Ryan Kelly. [ticket:2502] - [feature] Added support for DELETE and UPDATE from an alias of a table, which would assumedly be related to itself elsewhere in the query, courtesy Ryan Kelly. [ticket:2507] - [feature] Added support for the Postgresql ONLY keyword, which can appear corresponding to a table in a SELECT, UPDATE, or DELETE statement. The phrase is established using with_hint(). Courtesy Ryan Kelly [ticket:2506]
* - [feature] Added "MATCH" clause to ForeignKey,Mike Bayer2012-06-211-0/+7
| | | | | ForeignKeyConstraint, courtesy Ryan Kelly. [ticket:2502]
* - [bug] Repaired common table expressionMike Bayer2012-06-131-6/+13
| | | | | | | rendering to function correctly when the SELECT statement contains UNION or other compound expressions, courtesy btbuilder. [ticket:2490]
* - [bug] Quoting information is now passed alongMike Bayer2012-05-041-3/+4
| | | | | | | | from a Column with quote=True when generating a same-named bound parameter to the bindparam() object, as is the case in generated INSERT and UPDATE statements, so that unknown reserved names can be fully supported. [ticket:2437]
* - [feature] The "unconsumed column names" warning emittedMike Bayer2012-04-241-1/+1
| | | | | | when keys are present in insert.values() or update.values() that aren't in the target table is now an exception. [ticket:2415]
* - [feature] The behavior of column targetingMike Bayer2012-04-241-4/+14
| | | | | | | | | | | | | | in result sets is now case sensitive by default. SQLAlchemy for many years would run a case-insensitive conversion on these values, probably to alleviate early case sensitivity issues with dialects like Oracle and Firebird. These issues have been more cleanly solved in more modern versions so the performance hit of calling lower() on identifiers is removed. The case insensitive comparisons can be re-enabled by setting "case_insensitive=False" on create_engine(). [ticket:2423]
* - [bug] UPDATE..FROM syntax with SQL ServerMike Bayer2012-04-181-1/+1
| | | | | | | | | | requires that the updated table be present in the FROM clause when an alias of that table is also present in the FROM clause. The updated table is now always present in the FROM, when FROM is present in the first place. Courtesy sayap. [ticket:2468]
* typos in lib/sqlalchemy/sqlDiana Clarke2012-03-171-3/+3
|
* - [feature] Added support for MSSQL INSERT,Mike Bayer2012-03-131-5/+57
| | | | | | UPDATE, and DELETE table hints, using new with_hint() method on UpdateBase. [ticket:2430]
* - [bug] Fixed bug whereby a primaryjoinMike Bayer2012-03-121-1/+2
| | | | | | | | | condition with a "literal" in it would raise an error on compile with certain kinds of deeply nested expressions which also needed to render the same bound parameter name more than once. [ticket:2425]
* - [feature] Added cte() method to Query,Mike Bayer2012-03-031-0/+58
| | | | | | | | | | | | invokes common table expression support from the Core (see below). [ticket:1859] - [feature] Added support for SQL standard common table expressions (CTE), allowing SELECT objects as the CTE source (DML not yet supported). This is invoked via the cte() method on any select() construct. [ticket:1859]
* remove check_columns here so warning not emitted with update fromMike Bayer2012-02-261-1/+1
|
* - [bug] A warning is emitted when a not-presentMike Bayer2012-02-211-2/+12
| | | | | | | column is stated in the values() clause of an insert() or update() construct. Will move to an exception in 0.8. [ticket:2413]
* - [bug] Added support for using the .keyMike Bayer2012-02-051-7/+19
| | | | | | | | | | | | of a Column as a string identifier in a result set row. The .key is currently listed as an "alternate" name for a column, and is superseded by the name of a column which has that key value as its regular name. For the next major release of SQLAlchemy we may reverse this precedence so that .key takes precedence, but this is not decided on yet. [ticket:2392]
* - [bug] A significant change to how labelingMike Bayer2012-02-051-10/+10
| | | | | | | | | | | | | | is applied to columns in SELECT statements allows "truncated" labels, that is label names that are generated in Python which exceed the maximum identifier length (note this is configurable via label_length on create_engine()), to be properly referenced when rendered inside of a subquery, as well as to be present in a result set row using their original in-Python names. [ticket:2396] - apply pep8 to test_labels
* fix a few py3k bugsMike Bayer2012-01-281-0/+1
|
* - [feature] Dialect-specific compilers now raiseMike Bayer2012-01-281-13/+30
| | | | | | | | CompileException for all type/statement compilation issues, instead of InvalidRequestError or ArgumentError. The DDL for CREATE TABLE will re-raise CompileExceptions to include table/column information for the problematic column. [ticket:2361]
* - [bug] Fixed issue where the "required" exceptionMike Bayer2012-01-281-11/+22
| | | | | | would not be raised for bindparam() with required=True, if the statement were given no parameters at all. [ticket:2381]
* - [bug] Fixed bug whereby a table-bound ColumnMike Bayer2012-01-221-0/+4
| | | | | | | | | | | object named "<a>_<b>" which matched a column labeled as "<tablename>_<colname>" could match inappropriately when targeting in a result set row. [ticket:2377] - requires that we change the tuple format in RowProxy. Makes an improvement to the cases tested against an unpickled RowProxy as well though doesn't solve the problem there entirely.
* - Fixed regression from 0.6 whereby ifMike Bayer2012-01-101-7/+2
| | | | | | | "load_on_pending" relationship() flag were used where a non-"get()" lazy clause needed to be emitted on a pending object, it would fail to load.
* happy new yearMike Bayer2012-01-041-1/+1
|
* - [bug] the "name" of a column-level CHECK constraint,Mike Bayer2011-12-041-1/+5
| | | | | | if present, is now rendered in the CREATE TABLE statement using "CONSTRAINT <name> CHECK <expression>". [ticket:2305]
* also add support for onupdate as we'd like this to fire off if an UPDATE ↵Mike Bayer2011-11-221-13/+31
| | | | | | actually happens on the table
* fixes to actually get tests to passMike Bayer2011-11-221-17/+12
|
* cleanupMike Bayer2011-11-211-22/+42
|
* passes for all three, includes multi col system with mysqlMike Bayer2011-11-211-6/+32
|
* sort of muscling this out, mysql a PITAMike Bayer2011-11-211-7/+47
|
* - [feature] Added new support for remote "schemas":Mike Bayer2011-10-231-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | - MetaData() accepts "schema" and "quote_schema" arguments, which will be applied to the same-named arguments of a Table or Sequence which leaves these at their default of ``None``. - Sequence accepts "quote_schema" argument - tometadata() for Table will use the "schema" of the incoming MetaData for the new Table if the schema argument is explicitly "None" - Added CreateSchema and DropSchema DDL constructs - these accept just the string name of a schema and a "quote" flag. - When using default "schema" with MetaData, ForeignKey will also assume the "default" schema when locating remote table. This allows the "schema" argument on MetaData to be applied to any set of Table objects that otherwise don't have a "schema". - a "has_schema" method has been implemented on dialect, but only works on Postgresql so far. Courtesy Manlio Perillo, [ticket:1679]
* - Behavioral improvement: emptyMike Bayer2011-09-091-1/+1
| | | | | | | conjunctions such as and_() and or_() will be flattened in the context of an enclosing conjunction, i.e. and_(x, or_()) will produce 'X' and not 'X AND ()'. [ticket:2257].
* - It is an error to call query.get() when theMike Bayer2011-04-221-1/+1
| | | | | | | given entity is not a single, full class entity or mapper (i.e. a column). This is a deprecation warning in 0.6.8. [ticket:2144]