summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* Super-minor doc fixpr/39Jacob Magnusson2013-10-281-1/+1
|
* Merge branch 'master' of github.com:ijl/sqlalchemy into merge_2183Mike Bayer2013-10-251-1/+3
|\
| * #2183: Metadata.reflect() foreign keys include options when the dialect ↵ijl2013-10-131-1/+3
| | | | | | | | exposes it
* | - add migration notes for [ticket:2838]Mike Bayer2013-10-241-0/+18
| | | | | | | | | | - have TypeDecorator use process_bind_param for literal values if no process_literal_param is set
* | An overhaul of expression handling for special symbols particularlyMike Bayer2013-10-237-87/+277
| | | | | | | | | | | | | | | | | | | | with conjunctions, e.g. ``None`` :func:`.expression.null` :func:`.expression.true` :func:`.expression.false`, including consistency in rendering NULL in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to "1" or "0" for backends that don't feature ``true``/``false`` constants. [ticket:2804]
* | - A :func:`.bindparam` construct with a "null" type (e.g. no typeMike Bayer2013-10-212-13/+16
| | | | | | | | | | | | | | | | | | specified) is now copied when used in a typed expression, and the new copy is assigned the actual type of the compared column. Previously, this logic would occur on the given :func:`.bindparam` in place. Additionally, a similar process now occurs for :func:`.bindparam` constructs passed to :meth:`.ValuesBase.values` for a :class:`.Insert` or :class:`.Update` construct. [ticket:2850]
* | - Fixed bug where :func:`.type_coerce` would not interpret ORMMike Bayer2013-10-211-2/+2
| | | | | | | | | | elements with a ``__clause_element__()`` method properly. [ticket:2849]
* | - The typing system now handles the task of rendering "literal bind" values,Mike Bayer2013-10-203-46/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e.g. values that are normally bound parameters but due to context must be rendered as strings, typically within DDL constructs such as CHECK constraints and indexes (note that "literal bind" values become used by DDL as of :ticket:`2742`). A new method :meth:`.TypeEngine.literal_processor` serves as the base, and :meth:`.TypeDecorator.process_literal_param` is added to allow wrapping of a native literal rendering method. [ticket:2838] - enhance _get_colparams so that we can send flags like literal_binds into INSERT statements - add support in PG for inspecting standard_conforming_strings - add a new series of roundtrip tests based on INSERT of literal plus SELECT for basic literal rendering in dialect suite
* | - add a type_coerce() step within Enum, Boolean to the CHECK constraint,Mike Bayer2013-10-202-3/+6
| | | | | | | | | | | | | | | | so that the custom type isn't exposed to an operation that is against the "impl" type's constraint, [ticket:2842] - this change showed up as some recursion overflow in pickling with labels, add a __reduce__() there....pickling of expressions is less and less something that's very viable...
* | - The :meth:`.Table.tometadata` method now produces copies ofMike Bayer2013-10-181-13/+15
| | | | | | | | | | | | | | | | | | | | all :attr:`.SchemaItem.info` dictionaries from all :class:`.SchemaItem` objects within the structure including columns, constraints, foreign keys, etc. As these dictionaries are copies, they are independent of the original dictionary. Previously, only the ``.info`` dictionary of :class:`.Column` was transferred within this operation, and it was only linked in place, not copied. [ticket:2716]
* | The ``.unique`` flag on :class:`.Index` could be produced as ``None``Mike Bayer2013-10-141-1/+6
| | | | | | | | | | | | if it was generated from a :class:`.Column` that didn't specify ``unique`` (where it defaults to ``None``). The flag will now always be ``True`` or ``False``. [ticket:2825]
* | workaround for #2838 here. still need to figure out why an ENUM test is ↵Mike Bayer2013-10-141-0/+7
| | | | | | | | suddenly hitting this.
* | Perform fewer dict lookups - tiny microoptimizationpr/35Alex Gaynor2013-10-141-5/+4
| |
* | - Fixed bug in default compiler plus those of postgresql, mysql, andMike Bayer2013-10-122-23/+4
| | | | | | | | | | | | | | | | mssql to ensure that any literal SQL expression values are rendered directly as literals, instead of as bound parameters, within a CREATE INDEX statement. [ticket:2742] - don't need expression_as_ddl(); literal_binds and include_table take care of this functionality.
* | The ``default`` argument of :class:`.Column` now accepts a classMike Bayer2013-10-111-1/+1
| | | | | | | | | | or object method as an argument, in addition to a standalone function; will properly detect if the "context" argument is accepted or not.
* | The "name" attribute is set on :class:`.Index` before the "attach"Mike Bayer2013-10-111-3/+4
|/ | | | | | events are called, so that attachment events can be used to dynamically generate a name for the index based on the parent table and/or columns. [ticket:2835]
* A :func:`.select` that is made to refer to itself in its FROM clause,Mike Bayer2013-10-081-0/+3
| | | | | | typically via in-place mutation, will raise an informative error message rather than causing a recursion overflow. [ticket:2815]
* Fixed bug where using an annotation such as :func:`.remote` orMike Bayer2013-10-081-1/+6
| | | | | | | :func:`.foreign` on a :class:`.Column` before association with a parent :class:`.Table` could produce issues related to the parent table not rendering within joins, due to the inherent copy operation performed by an annotation. [ticket:2813]
* The erroneous kw arg "schema" has been removed from the :class:`.ForeignKey`Mike Bayer2013-10-081-1/+0
| | | | | object. this was an accidental commit that did nothing; a warning is raised in 0.8.3 when this kw arg is used. [ticket:2831]
* - fix propagation of quote flag within _gen_label() so that if theMike Bayer2013-10-051-1/+8
| | | | | | name is already an instance of _anonymous_label(), we don't downgrade it to a plain quoted_name - fixes regression from [ticket:2812]. [ticket:2834]
* Replace a big loop + dict lookup in Connection.execute() with a simple visitorpr/30Alex Gaynor2013-09-255-0/+15
| | | | pattern
* comment this alternative approach...Mike Bayer2013-08-281-0/+7
|
* more seealsos...Mike Bayer2013-08-271-3/+4
|
* - A rework to the way that "quoted" identifiers are handled, in thatMike Bayer2013-08-277-115/+245
| | | | | | | | | | | | | | | | instead of relying upon various ``quote=True`` flags being passed around, these flags are converted into rich string objects with quoting information included at the point at which they are passed to common schema constructs like :class:`.Table`, :class:`.Column`, etc. This solves the issue of various methods that don't correctly honor the "quote" flag such as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name` object is a string subclass that can also be used explicitly if needed; the object will hold onto the quoting preferences passed and will also bypass the "name normalization" performed by dialects that standardize on uppercase symbols, such as Oracle, Firebird and DB2. The upshot is that the "uppercase" backends can now work with force-quoted names, such as lowercase-quoted names and new reserved words. [ticket:2812]
* - restore constructor docs blown away in the mergeMike Bayer2013-08-251-0/+141
|
* - The ``version_id_generator`` parameter of ``Mapper`` can now be specifiedMike Bayer2013-08-253-151/+113
| | | | | | | | | | | | | | | | | | | | | to rely upon server generated version identifiers, using triggers or other database-provided versioning features, by passing the value ``False``. The ORM will use RETURNING when available to immediately load the new version identifier, else it will emit a second SELECT. [ticket:2793] - The ``eager_defaults`` flag of :class:`.Mapper` will now allow the newly generated default values to be fetched using an inline RETURNING clause, rather than a second SELECT statement, for backends that support RETURNING. - Added a new variant to :meth:`.ValuesBase.returning` called :meth:`.ValuesBase.return_defaults`; this allows arbitrary columns to be added to the RETURNING clause of the statement without interfering with the compilers usual "implicit returning" feature, which is used to efficiently fetch newly generated primary key values. For supporting backends, a dictionary of all fetched values is present at :attr:`.ResultProxy.returned_defaults`. - add a glossary entry for RETURNING - add documentation for version id generation, [ticket:867]
* forgot to add system to the copy() methodMike Bayer2013-08-251-0/+1
| | | | | Conflicts: lib/sqlalchemy/schema.py
* added "system=True" to Column, so that we generally don't have to botherMike Bayer2013-08-253-5/+26
| | | | with CreateColumn rules
* - The :class:`.CreateColumn` construct can be appled to a customMike Bayer2013-08-242-3/+34
| | | | | compilation rule which allows skipping of columns, by producing a rule that returns ``None``. Also in 0.8.3.
* additoinalMike Bayer2013-08-181-2/+19
|
* Fixed regression dating back to 0.7.9 whereby the name of a CTE mightMike Bayer2013-08-181-1/+1
| | | | | not be properly quoted if it was referred to in multiple FROM clauses. Also in 0.8.3, 0.7.11. [ticket:2801]
* merge error here, though also hedge between explaining about the expressions ↵Mike Bayer2013-08-161-7/+0
| | | | | | here vs. hoping they read the class-level docstring
* - apply an import refactoring to the ORM as wellMike Bayer2013-08-147-44/+80
| | | | | | | | | - rework the event system so that event modules load after their targets, dependencies are reversed - create an improved strategy lookup system for the ORM - rework the ORM to have very few import cycles - move out "importlater" to just util.dependency - other tricks to cross-populate modules in as clear a way as possible
* fix missing savepoint structuresMike Bayer2013-08-121-0/+3
|
* - header commentsMike Bayer2013-08-126-5/+17
|
* - A large refactoring of the ``sqlalchemy.sql`` package has reorganizedMike Bayer2013-08-1215-7021/+13559
| | | | | | | | | | | | | | | | | | | | | | the import structure of many core modules. ``sqlalchemy.schema`` and ``sqlalchemy.types`` remain in the top-level package, but are now just lists of names that pull from within ``sqlalchemy.sql``. Their implementations are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``, ``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``, ``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``. Most of the "factory" functions used to create SQL expression objects have been moved to classmethods or constructors, which are exposed in ``sqlalchemy.sql.expression`` using a programmatic system. Care has been taken such that all the original import namespaces remain intact and there should be no impact on any existing applications. The rationale here was to break out these very large modules into smaller ones, provide more manageable lists of function names, to greatly reduce "import cycles" and clarify the up-front importing of names, and to remove the need for redundant functions and documentation throughout the expression package.
* - The :meth:`.Operators.notin_` operator added in 0.8 now properlyMike Bayer2013-08-071-1/+4
| | | | | produces the negation of the expression "IN" returns when used against an empty collection. Also in 0.8.3.
* - Fixed bug in common table expression system where if the CTE wereMike Bayer2013-07-312-12/+18
| | | | | | used only as an ``alias()`` construct, it would not render using the WITH keyword. Also in 0.8.3, 0.7.11. [ticket:2783]
* - fix issue in join rewriting whereby we need to ensure the .key and .nameMike Bayer2013-07-271-1/+3
| | | | | | are transferred correctly for when .key is present; tests have been enhanced to test this condition for render, result map construction, statement execution. [ticket:2790]
* Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from aMike Bayer2013-07-171-1/+3
| | | | | :class:`.Column` object would not be propagated. Also in 0.8.3, 0.7.11. [ticket:2784]
* - use inline=True for the insert..select here so it works on oracleMike Bayer2013-07-121-0/+11
|
* Fixed bug where the expression system relied upon the ``str()``Mike Bayer2013-07-123-5/+23
| | | | | | | | | | | | form of a some expressions when referring to the ``.c`` collection on a ``select()`` construct, but the ``str()`` form isn't available since the element relies on dialect-specific compilation constructs, notably the ``__getitem__()`` operator as used with a Postgresql ``ARRAY`` element. The fix also adds a new exception class :class:`.UnsupportedCompilationError` which is raised in those cases where a compiler is asked to compile something it doesn't know how to. Also in 0.8.3. [ticket:2780]
* - Added new method to the :func:`.insert` constructMike Bayer2013-07-052-3/+52
| | | | | | | | | | :meth:`.Insert.from_select`. Given a list of columns and a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``. While this feature is highlighted as part of 0.9 it is also backported to 0.8.3. [ticket:722] - The :func:`.update`, :func:`.insert`, and :func:`.delete` constructs will now interpret ORM entities as FROM clauses to be operated upon, in the same way that select() already does. Also in 0.8.3.
* Fixed bug when using multi-table UPDATE where a supplementalMike Bayer2013-07-021-2/+2
| | | | | | | table is a SELECT with its own bound parameters, where the positioning of the bound parameters would be reversed versus the statement itself when using MySQL's special syntax. [ticket:2768]
* - rework of correlation, continuing on #2668, #2746Mike Bayer2013-06-262-60/+184
| | | | | | | | | | | | | | | | | | | | | | | | - add support for correlations to propagate all the way in; because correlations require context now, need to make sure a select enclosure of any level takes effect any number of levels deep. - fix what we said correlate_except() was supposed to do when we first released #2668 - "the FROM clause is left intact if the correlated SELECT is not used in the context of an enclosing SELECT..." - it was not considering the "existing_froms" collection at all, and prohibited additional FROMs from being placed in an any() or has(). - add test for multilevel any() - lots of docs, including glossary entries as we really need to define "WHERE clause", "columns clause" etc. so that we can explain correlation better - based on the insight that a SELECT can correlate anything that ultimately came from an enclosing SELECT that links to this one via WHERE/columns/HAVING/ORDER BY, have the compiler keep track of the FROM lists that correspond in this way, link it to the asfrom flag, so that we send to _get_display_froms() the exact list of candidate FROMs to correlate. no longer need any asfrom logic in the Select() itself - preserve 0.8.1's behavior for correlation when no correlate options are given, not to mention 0.7 and prior's behavior of not propagating implicit correlation more than one level.. this is to reduce surprises/hard-to-debug situations when a user isn't trying to correlate anything.
* The resolution of :class:`.ForeignKey` objects to theirMike Bayer2013-06-231-1/+3
| | | | | | | | | | | | | | | | | | target :class:`.Column` has been reworked to be as immediate as possible, based on the moment that the target :class:`.Column` is associated with the same :class:`.MetaData` as this :class:`.ForeignKey`, rather than waiting for the first time a join is constructed, or similar. This along with other improvements allows earlier detection of some foreign key configuration issues. Also included here is a rework of the type-propagation system, so that it should be reliable now to set the type as ``None`` on any :class:`.Column` that refers to another via :class:`.ForeignKey` - the type will be copied from the target column as soon as that other column is associated, and now works for composite foreign keys as well. [ticket:1765]
* Provided a new attribute for :class:`.TypeDecorator`Mike Bayer2013-06-221-2/+5
| | | | | | | | | called :attr:`.TypeDecorator.coerce_to_is_types`, to make it easier to control how comparisons using ``==`` or ``!=`` to ``None`` and boolean types goes about producing an ``IS`` expression, or a plain equality expression with a bound parameter. [ticket:2744]
* cleanupMike Bayer2013-06-082-15/+6
|
* - tests for the alias() APIMike Bayer2013-06-081-11/+90
| | | | - docs docs docs
* - Fixed an obscure bug where the wrong results would beMike Bayer2013-06-071-0/+2
| | | | | | | | | | | fetched when joining/joinedloading across a many-to-many relationship to a single-table-inheriting subclass with a specific discriminator value, due to "secondary" rows that would come back. The "secondary" and right-side tables are now inner joined inside of parenthesis for all ORM joins on many-to-many relationships so that the left->right join can accurately filtered. [ticket:2369]