summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - rework ColumnAdapter and ORMAdapter to only provide the featuresticket_3148Mike Bayer2014-09-072-78/+69
| | | | | | | | | | | we're now using; rework them fully so that their behavioral contract is consistent regarding adapter.traverse() vs. adapter.columns[], add a full suite of tests including advanced wrapping scenarios previously only covered by test/orm/test_froms.py and test/orm/inheritance/test_relationships.py - identify several cases where label._order_by_label_clause would be corrupted, e.g. due to adaption or annotation separately - add full tests for #3148
* - enhance ClauseAdapter / ColumnAdapter to have new behaviors with labels.Mike Bayer2014-09-073-21/+33
| | | | | | | | | | | | | | | | | | | | | The "anonymize label" logic is now generalized to ClauseAdapter, and takes place when the anonymize_labels flag is sent, taking effect for all .columns lookups as well as within traverse() calls against the label directly. - traverse() will also memoize what it gets in columns, so that calling upon traverse() / .columns against the same Label will produce the same anonymized label. This is so that AliasedClass produces the same anonymized label when it is accessed per-column (e.g. SomeAlias.some_column) as well as when it is applied to a Query, and within column loader strategies (e.g. query(SomeAlias)); the former uses traverse() while the latter uses .columns - AliasedClass now calls onto ColumnAdapter - Query also makes sure to use that same ColumnAdapter from the AliasedClass in all cases - update the logic from 0.9 in #1068 to make use of the same _label_resolve_dict we use for #2992, simplifying how that works and adding support for new scenarios that were pretty broken (see #3148, #3188)
* wip for #3148Mike Bayer2014-09-064-9/+44
|
* - document all the varities of _label on the base ColumnElementMike Bayer2014-09-062-12/+56
| | | | | - replace out _columns_clause_label with a straight boolean flag to reduce the proliferation of labels
* - tiny refactors #1-#5Mike Bayer2014-09-051-3/+12
|
* - ensure literal_binds works with LIMIT clause, FOR UPDATEMike Bayer2014-09-031-6/+6
|
* - add logic to compiler such that if stack is empty, we justMike Bayer2014-09-023-2/+13
| | | | | | | | | | | | | | | | stringify a _label_reference() as is. - add .key to _label_reference(), so that when _make_proxy() is called, we don't call str() on it anyway. - add a test to exercise Query's behavior of adding all the order_by expressions to the columns list of the select, assert that things work out when we have a _label_reference there, that it gets sucked into the columns list and spit out on the other side, it's referred to appropriately, etc. _label_reference() could theoretically be resolved at the point we iterate _raw_columns() but it's better to just let things work as they already do (except nicer, since we get "tablename.colname" instead of just "somename" in the columns list) so that we aren't adding a ton of overhead to _columns_plus_names in the common case.
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-016-41/+167
| | | | | | | | | | | | | | | | | | | | | constructs are now importable from the "from sqlalchemy" namespace, just like every other Core construct. - The implicit conversion of strings to :func:`.text` constructs when passed to most builder methods of :func:`.select` as well as :class:`.Query` now emits a warning with just the plain string sent. The textual conversion still proceeds normally, however. The only method that accepts a string without a warning are the "label reference" methods like order_by(), group_by(); these functions will now at compile time attempt to resolve a single string argument to a column or label expression present in the selectable; if none is located, the expression still renders, but you get the warning again. The rationale here is that the implicit conversion from string to text is more unexpected than not these days, and it is better that the user send more direction to the Core / ORM when passing a raw string as to what direction should be taken. Core/ORM tutorials have been updated to go more in depth as to how text is handled. fixes #2992
* - more updates to text docs, literal_column, column etc. in prepMike Bayer2014-09-011-9/+20
| | | | for ticket 2992.
* - A new style of warning can be emitted which will "filter" up toMike Bayer2014-08-312-6/+14
| | | | | | | | | N occurrences of a parameterized string. This allows parameterized warnings that can refer to their arguments to be delivered a fixed number of times until allowing Python warning filters to squelch them, and prevents memory from growing unbounded within Python's warning registries. fixes #3178
* - this is small optimization, currently it's the best we can doMike Bayer2014-08-281-1/+2
| | | | for #3175. fixes #3175 (for now)
* Fix copy-paste error in Delete docGunnlaugur Þór Briem2014-08-211-2/+2
|
* - fix linkMike Bayer2014-08-211-1/+1
|
* - The INSERT...FROM SELECT construct now implies ``inline=True``Mike Bayer2014-08-202-14/+24
| | | | | | | | | | | | | | | | | | | | | | | on :class:`.Insert`. This helps to fix a bug where an INSERT...FROM SELECT construct would inadvertently be compiled as "implicit returning" on supporting backends, which would cause breakage in the case of an INSERT that inserts zero rows (as implicit returning expects a row), as well as arbitrary return data in the case of an INSERT that inserts multiple rows (e.g. only the first row of many). A similar change is also applied to an INSERT..VALUES with multiple parameter sets; implicit RETURNING will no longer emit for this statement either. As both of these constructs deal with varible numbers of rows, the :attr:`.ResultProxy.inserted_primary_key` accessor does not apply. Previously, there was a documentation note that one may prefer ``inline=True`` with INSERT..FROM SELECT as some databases don't support returning and therefore can't do "implicit" returning, but there's no reason an INSERT...FROM SELECT needs implicit returning in any case. Regular explicit :meth:`.Insert.returning` should be used to return variable numbers of result rows if inserted data is needed. fixes #3169
* - don't add the parent attach event within _on_table_attachMike Bayer2014-08-151-1/+2
| | | | | if we already have a table; this prevents reentrant calls and we aren't supporting columns/etc being moved around between different parents
* - The ``info`` parameter has been added to the constructor forMike Bayer2014-08-131-7/+47
| | | | | | | | | | | :class:`.SynonymProperty` and :class:`.ComparableProperty`. - The ``info`` parameter has been added as a constructor argument to all schema constructs including :class:`.MetaData`, :class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`, :class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`, :class:`.CheckConstraint`. fixes #2963
* - rework documentation for reflection flags; also includeMike Bayer2014-08-091-42/+99
| | | | information regarding #3027.
* Providing an autoload_with info automatically sets autoload to TrueMalik Diarra2014-08-091-2/+2
|
* - Fixed bug in CTE where ``literal_binds`` compiler argument would notMike Bayer2014-08-021-1/+1
| | | | | | be always be correctly propagated when one CTE referred to another aliased CTE in a statement. Fixes #3154
* - Fixed 0.9.7 regression caused by :ticket:`3067` in conjunction withMike Bayer2014-07-291-0/+3
| | | | | | a mis-named unit test such that so-called "schema" types like :class:`.Boolean` and :class:`.Enum` could no longer be pickled. fixes #3144
* - Added a supported :meth:`.FunctionElement.alias` method to functions,Mike Bayer2014-07-242-6/+50
| | | | | | | | | e.g. the ``func`` construct. Previously, behavior for this method was undefined. The current behavior mimics that of pre-0.9.4, which is that the function is turned into a single-column FROM clause with the given alias name, where the column itself is anonymously named. fixes #3137
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-2018-1807/+1988
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - Fixed a SQLite join rewriting issue where a subquery that is embeddedMike Bayer2014-07-153-8/+12
| | | | | | | | as a scalar subquery such as within an IN would receive inappropriate substitutions from the enclosing query, if the same table were present inside the subquery as were in the enclosing query such as in a joined inheritance scenario. fixes #3130
* - wrestle with conv() and tests some moreMike Bayer2014-07-142-42/+53
|
* - allow the compilation rule that gets the formatted nameMike Bayer2014-07-143-14/+24
| | | | | to again have the chance to veto rendering, as the naming convention can make the decision that the name is "none" or not now.
* - Fix bug in naming convention feature where using a checkMike Bayer2014-07-144-19/+49
| | | | | | | | | | | | | constraint convention that includes ``constraint_name`` would then force all :class:`.Boolean` and :class:`.Enum` types to require names as well, as these implicitly create a constraint, even if the ultimate target backend were one that does not require generation of the constraint such as Postgresql. The mechanics of naming conventions for these particular constraints has been reorganized such that the naming determination is done at DDL compile time, rather than at constraint/table construction time. fixes #3067
* -Fixed bug in common table expressions whereby positional boundMike Bayer2014-07-141-7/+10
| | | | | | parameters could be expressed in the wrong final order when CTEs were nested in certain ways. fixes #3090
* - Fixed bug where multi-valued :class:`.Insert` construct would failMike Bayer2014-07-141-2/+4
| | | | | | to check subsequent values entries beyond the first one given for literal SQL expressions. fixes #3069
* - Added a "str()" step to the dialect_kwargs iteration forMike Bayer2014-07-141-1/+1
| | | | | | | Python version < 2.6.5, working around the "no unicode keyword arg" bug as these args are passed along as keyword args within some reflection processes. fixes #3123
* - Fixed bug in :class:`.Enum` and other :class:`.SchemaType`Mike Bayer2014-07-131-6/+9
| | | | | | | subclasses where direct association of the type with a :class:`.MetaData` would lead to a hang when events (like create events) were emitted on the :class:`.MetaData`. fixes #3124
* - The :meth:`.TypeEngine.with_variant` method will now accept aMike Bayer2014-07-101-1/+1
| | | | | | type class as an argument which is internally converted to an instance, using the same convention long established by other constructs such as :class:`.Column`. fixes #3122
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-0918-18/+36
| | | | to get all flake8 passing
* - add postgresql_regconfig argument to PG dialect for match() operator,jonathan vanasco2014-07-082-3/+3
| | | | implements PG's to_tsquery('regconfig', 'arg') pattern. fixes #3078
* - add link to dialect docs for SQLite autoincrement from column autoincrement,Mike Bayer2014-07-031-2/+5
| | | | fixes #3110
* - add new section Working with Raw DBAPI Connections, fixes #2218.Mike Bayer2014-06-301-0/+9
|
* - attach the ResultMetaData to the Compiled object, when we detect thatMike Bayer2014-06-291-0/+2
| | | | | the compiled cache is used. That allows us to cache the whole metadata and save on creating it at result time, when compiled cache is used.
* - Fixed a bug within the custom operator plus :meth:`.TypeEngine.with_variant`Mike Bayer2014-06-271-2/+7
| | | | | | system, whereby using a :class:`.TypeDecorator` in conjunction with variant would fail with an MRO error when a comparison operator was used. fixes #3102
* - write some really complete docs on MSSQL autoincrement, fixes #3094Mike Bayer2014-06-241-3/+10
|
* - The :paramref:`.Column.nullable` flag is implicitly set to ``False``Mike Bayer2014-06-201-0/+1
| | | | | | | | | when that :class:`.Column` is referred to in an explicit :class:`.PrimaryKeyConstraint` for that table. This behavior now matches that of when the :class:`.Column` itself has the :paramref:`.Column.primary_key` flag set to ``True``, which is intended to be an exactly equivalent case. fixes #3023
* Update compiler.pyBY-jk2014-06-081-1/+2
| | | | | | Moved initialization into else block Conflicts: lib/sqlalchemy/sql/compiler.py
* - Fixed bug in INSERT..FROM SELECT construct where selecting from aMike Bayer2014-05-251-1/+1
| | | | | UNION would wrap the union in an anonymous (e.g. unlabled) subquery. fixes #3044
* - Fixed bug in SQLite join rewriting where anonymized column namesMike Bayer2014-05-251-0/+3
| | | | | | due to repeats would not correctly be rewritten in subqueries. This would affect SELECT queries with any kind of subquery + join. fixes #3057
* - Fixed bug where the :meth:`.Operators.__and__`,Mike Bayer2014-05-242-8/+40
| | | | | | | :meth:`.Operators.__or__` and :meth:`.Operators.__invert__` operator overload methods could not be overridden within a custom :class:`.TypeEngine.Comparator` implementation. fixes #3012
* - hyperlink all the column operators listed in the ORM tutorial common ↵Mike Bayer2014-05-241-4/+10
| | | | | | | | | filter operators section - add language to MATCH explicitly stating this operator varies by backend and is not available on SQLite, as the tutorial defaults to SQLite to start with, fix #3059 - on the actual match() documentation fix this up to be more accurate, list some example renderings for different backends. again mention SQLite not supported
* - document the compiler_kwargs accessorMike Bayer2014-05-231-0/+20
| | | | - add new FAQ for rendering SQL as a string
* - more tests, including backend testsMike Bayer2014-05-161-30/+54
| | | | - implement for SQL server, use window functions when simple limit/offset not available
* Merge branch 'issue_3034' of ↵Mike Bayer2014-05-162-14/+75
|\ | | | | | | https://bitbucket.org/dobesv/sqlalchemy/branch/issue_3034 into ticket_3034
| * Remove unused importDobes Vandermeer2014-05-091-6/+29
| |
| * Remove unused importDobes Vandermeer2014-04-251-1/+1
| |
| * Remove unused importDobes Vandermeer2014-04-251-1/+0
| |