summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* - Fixed bug where :meth:`.Table.update` and :meth:`.Table.delete`Mike Bayer2014-05-081-3/+6
| | | | | | | would produce an empty WHERE clause when an empty :func:`.and_()` or :func:`.or_()` or other blank expression were applied. This is now consistent with that of :func:`.select`. fixes #3045
* - Fixed bug where the combination of "limit" rendering asMike Bayer2014-04-301-13/+14
| | | | | | | | | "SELECT FIRST n ROWS" using a bound parameter (only firebird has both), combined with column-level subqueries which also feature "limit" as well as "positional" bound parameters (e.g. qmark style) would erroneously assign the subquery-level positions before that of the enclosing SELECT, thus returning parameters which are out of order. Fixes #3038
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-267-18/+18
| | | | Found using: https://github.com/intgr/topy
* - The "primaryjoin" model has been stretched a bit further to allowMike Bayer2014-04-191-1/+1
| | | | | | | | | | a join condition that is strictly from a single column to itself, translated through some kind of SQL function or expression. This is kind of experimental, but the first proof of concept is a "materialized path" join condition where a path string is compared to itself using "like". The :meth:`.Operators.like` operator has also been added to the list of valid operators to use in a primaryjoin condition. fixes #3029
* - Liberalized the contract for :class:`.Index` a bit in that you canMike Bayer2014-04-193-12/+41
| | | | | | | specify a :func:`.text` expression as the target; the index no longer needs to have a table-bound column present if the index is to be manually added to the table, either via inline declaration or via :meth:`.Table.append_constraint`. fixes #3028
* - Fixed bug in new :meth:`.DialectKWArgs.argument_for` method whereMike Bayer2014-04-151-0/+2
| | | | | adding an argument for a construct not previously included for any special arguments would fail. fixes #3024
* - Fixed regression introduced in 0.9 where new "ORDER BY <labelname>"Mike Bayer2014-04-101-1/+1
| | | | | | feature from :ticket:`1068` would not apply quoting rules to the label name as rendered in the ORDER BY. fix #3020, re: #1068
* - Restored the import for :class:`.Function` to the ↵Mike Bayer2014-04-051-1/+1
| | | | | | ``sqlalchemy.sql.expression`` import namespace, which was removed at the beginning of 0.9.
* escape backslashMike Bayer2014-04-021-1/+1
|
* - reverse order of columns in sample CTEs as this is a UNION and the cols ↵Mike Bayer2014-04-021-3/+1
| | | | | | | | | | need to line up - alter this in the unit tests as well as these queries were just copied from the tests - remove the included_parts.join(parts) from the core CTE doc (also just copied from the test, where we want to make sure joins don't get screwed up with the CTE) as it doesn't contribute to the query itself fixes #3014
* - back off the callcounts a bit for the boolean fixMike Bayer2014-04-011-3/+4
| | | | - rewrite callcounts for select()
* - Fixes to the newly enhanced boolean coercion in :ticket:`2804` whereMike Bayer2014-04-011-2/+2
| | | | | | | the new rules for "where" and "having" woudn't take effect for the "whereclause" and "having" kw arguments of the :func:`.select` construct, which is also what :class:`.Query` uses so wasn't working in the ORM either. fixes #3013 re: #2804
* - Added new flag :paramref:`.expression.between.symmetric`, when set to TrueMike Bayer2014-03-304-9/+36
| | | | | | | renders "BETWEEN SYMMETRIC". Also added a new negation operator "notbetween_op", which now allows an expression like ``~col.between(x, y)`` to render as "col NOT BETWEEN x AND y", rather than a parentheiszed NOT string. fixes #2990
* - add further coverage for join_condition to make sure we get this case whereMike Bayer2014-03-281-1/+1
| | | | there are multiple, equivalent foreign keys
* - fix set syntax supposed to be dictMike Bayer2014-03-281-1/+1
|
* - fix py3k bug re: dictionary values(), fixes #3005Mike Bayer2014-03-281-1/+1
|
* - Improved the check for "how to join from A to B" such that whenMike Bayer2014-03-271-16/+34
| | | | | | | | | a table has multiple, composite foreign keys targeting a parent table, the :paramref:`.relationship.foreign_keys` argument will be properly interpreted in order to resolve the ambiguity; previously this condition would raise that there were multiple FK paths when in fact the foreign_keys argument should be establishing which one is expected. fixes #2965
* Merge branch 'fix_table_registration' of https://github.com/malor/sqlalchemy ↵Mike Bayer2014-03-221-1/+1
|\ | | | | | | into t
| * Remove tables from metadata when autoload failspr/78Roman Podoliaka2014-03-121-1/+1
| | | | | | | | | | | | | | | | If autoloading of a table fails, don't register it in a metadata instance. It seems that the original behaviour was accidentally changed in f6198d9abf453182f4b111e0579a7a4ef1614e79, restore it. Closes issue #2988
* | - Added support for literal rendering of boolean values, e.g.Mike Bayer2014-03-131-0/+9
|/ | | | | "true" / "false" or "1" / "0". - added Boolean tests to the test suite
* - Added a new feature :func:`.schema.conv`, the purpose of which is toMike Bayer2014-03-121-5/+45
| | | | | | | | mark a constraint name as already having had a naming convention applied. This token will be used by Alembic migrations as of Alembic 0.6.4 in order to render constraints in migration scripts with names marked as already having been subject to a naming convention. re: #2991
* :paramref:`.MetaData.naming_convention` feature will now alsoMike Bayer2014-03-121-2/+9
| | | | | | apply to :class:`.CheckConstraint` objects that are associated directly with a :class:`.Column` instead of just on the :class:`.Table`.
* - Fixed bug in new :paramref:`.MetaData.naming_convention` featureMike Bayer2014-03-122-3/+3
| | | | | | | | | where the name of a check constraint making use of the `"%(constraint_name)s"` token would get doubled up for the constraint generated by a boolean or enum type, and overall duplicate events would cause the `"%(constraint_name)s"` token to keep compounding itself. fixes #2991
* - Support has been added for pytest to run tests. This runnerMike Bayer2014-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | is currently being supported in addition to nose, and will likely be preferred to nose going forward. The nose plugin system used by SQLAlchemy has been split out so that it works under pytest as well. There are no plans to drop support for nose at the moment and we hope that the test suite itself can continue to remain as agnostic of testing platform as possible. See the file README.unittests.rst for updated information on running tests with pytest. The test plugin system has also been enhanced to support running tests against mutiple database URLs at once, by specifying the ``--db`` and/or ``--dburi`` flags multiple times. This does not run the entire test suite for each database, but instead allows test cases that are specific to certain backends make use of that backend as the test is run. When using pytest as the test runner, the system will also run specific test suites multiple times, once for each database, particularly those tests within the "dialect suite". The plan is that the enhanced system will also be used by Alembic, and allow Alembic to run migration operation tests against multiple backends in one run, including third-party backends not included within Alembic itself. Third party dialects and extensions are also encouraged to standardize on SQLAlchemy's test suite as a basis; see the file README.dialects.rst for background on building out from SQLAlchemy's test platform.
* - get util.get_callable_argspec() to be completely bulletproof for 2.6-3.4,Mike Bayer2014-03-021-27/+3
| | | | | methods, classes, builtins, functools.partial(), everything known so far - use get_callable_argspec() within ColumnDefault._maybe_wrap_callable, re: #2979
* - Fixed some test/feature failures occurring in Python 3.4,Mike Bayer2014-03-021-1/+8
| | | | | | in particular the logic used to wrap "column default" callables wouldn't work properly for Python built-ins. fixes #2979
* - Fixed bug in :func:`.tuple_` construct where the "type" of essentiallyMike Bayer2014-02-271-5/+6
| | | | | | | | | | | the first SQL expression would be applied as the "comparison type" to a compared tuple value; this has the effect in some cases of an inappropriate "type coersion" occurring, such as when a tuple that has a mix of String and Binary values improperly coerces target values to Binary even though that's not what they are on the left side. :func:`.tuple_` now expects heterogeneous types within its list of values. fixes #2977
* restore the contracts of update/extend to the degree that the same column ↵Mike Bayer2014-02-271-3/+5
| | | | | | identity isn't appended to the list. reflection makes use of this.
* - Adjusted the logic which applies names to the .c collection whenMike Bayer2014-02-261-6/+9
| | | | | | | | | a no-name :class:`.BindParameter` is received, e.g. via :func:`.sql.literal` or similar; the "key" of the bind param is used as the key within .c. rather than the rendered name. Since these binds have "anonymous" names in any case, this allows individual bound parameters to have their own name within a selectable if they are otherwise unlabeled. fixes #2974
* - Some changes to how the :attr:`.FromClause.c` collection behavesMike Bayer2014-02-262-32/+54
| | | | | | | | | | | | | | | | | | | | | | | when presented with duplicate columns. The behavior of emitting a warning and replacing the old column with the same name still remains to some degree; the replacement in particular is to maintain backwards compatibility. However, the replaced column still remains associated with the ``c`` collection now in a collection ``._all_columns``, which is used by constructs such as aliases and unions, to deal with the set of columns in ``c`` more towards what is actually in the list of columns rather than the unique set of key names. This helps with situations where SELECT statements with same-named columns are used in unions and such, so that the union can match the columns up positionally and also there's some chance of :meth:`.FromClause.corresponding_column` still being usable here (it can now return a column that is only in selectable.c._all_columns and not otherwise named). The new collection is underscored as we still need to decide where this list might end up. Theoretically it would become the result of iter(selectable.c), however this would mean that the length of the iteration would no longer match the length of keys(), and that behavior needs to be checked out. fixes #2974 - add a bunch more tests for ColumnCollection
* - Fixed issue in new :meth:`.TextClause.columns` method where the orderingMike Bayer2014-02-261-7/+7
| | | | | | of columns given positionally would not be preserved. This could have potential impact in positional situations such as applying the resulting :class:`.TextAsFrom` object to a union.
* - use MutableMapping to make this more succinct, completeMike Bayer2014-02-261-47/+35
|
* docsMike Bayer2014-02-251-3/+10
|
* - The new dialect-level keyword argument system for schema-levelMike Bayer2014-02-251-13/+156
| | | | | | | | | constructs has been enhanced in order to assist with existing schemes that rely upon addition of ad-hoc keyword arguments to constructs. - To suit the use case of allowing custom arguments at construction time, the :meth:`.DialectKWArgs.argument_for` method now allows this registration. fixes #2962
* - More fixes to SQLite "join rewriting"; the fix from :ticket:`2967`Mike Bayer2014-02-202-12/+28
| | | | | | | | | | | | | | implemented right before the release of 0.9.3 affected the case where a UNION contained nested joins in it. "Join rewriting" is a feature with a wide range of possibilities and is the first intricate "SQL rewriting" feature we've introduced in years, so we're sort of going through a lot of iterations with it (not unlike eager loading back in the 0.2/0.3 series, polymorphic loading in 0.4/0.5). We should be there soon so thanks for bearing with us :). fixes #2969 re: #2967 - solve the issue of join rewriting inspecting various types of from objects without using isinstance(), by adding some new underscored inspection flags to the FromClause hierarchy.
* - re: #2967, also fixed a somewhat related issue where join rewriting would failMike Bayer2014-02-191-0/+5
| | | | | on the columns clause of the SELECT statement if the targets were aliased tables, as opposed to individual aliased columns.
* - Fixed bug in SQLite "join rewriting" where usage of an exists() constructMike Bayer2014-02-191-3/+3
| | | | | would fail to be rewritten properly, such as when the exists is mapped to a column_property in an intricate nested-join scenario. #2967
* - Fixed bug where calling :meth:`.Insert.values` with an empty listMike Bayer2014-02-191-0/+1
| | | | | or tuple would raise an IndexError. It now produces an empty insert construct as would be the case with an empty dictionary.
* - Fixed bug where :meth:`.in_()` would go into an endless loop ifMike Bayer2014-02-131-3/+7
| | | | | | erroneously passed a column expression whose comparator included the ``__getitem__()`` method, such as a column that uses the :class:`.postgresql.ARRAY` type. [ticket:2957]
* - for TextAsFrom, put the "inner" columns in the result map directly.Mike Bayer2014-02-101-4/+3
| | | | | | | Have also considered linking column.label() to the "column" itself being in the result map but this reveals some naming collision problems (that also seem to be very poorly tested...). This should be as far as we want to go right now with [ticket:2932].
* - More issues with [ticket:2932] first resolved in 0.9.2 whereMike Bayer2014-02-051-2/+2
| | | | | | | | | | using a column key of the form ``<tablename>_<columnname>`` matching that of an aliased column in the text would still not match at the ORM level, which is ultimately due to a core column-matching issue. Additional rules have been added so that the column ``_label`` is taken into account when working with a :class:`.TextAsFrom` construct or with literal columns. [ticket:2932]
* Add naming convention support when using schema in the metadata.pr/67Tom Farvour2014-02-051-2/+10
|
* - Fixed bug where so-called "literal render" of :func:`.bindparam`Mike Bayer2014-02-051-2/+2
| | | | | | constructs would fail if the bind were constructed with a callable, rather than a direct value. This prevented ORM expressions from being rendered with the "literal_binds" compiler flag.
* - Fixed bug which prevented MySQLdb-based dialects (e.g.Mike Bayer2014-02-031-1/+0
| | | | | | | | | | pymysql) from working in Py3K, where a check for "connection charset" would fail due to Py3K's more strict value comparison rules. The call in question wasn't taking the database version into account in any case as the server version was still None at that point, so the method overall has been simplified to rely upon connection.character_set_name(). [ticket:2933]
* - Added :paramref:`.MetaData.reflect.**dialect_kwargs`Mike Bayer2014-02-021-1/+12
| | | | | | | | | | | | | | | | | | to support dialect-level reflection options for all :class:`.Table` objects reflected. - Added a new dialect-level argument ``postgresql_ignore_search_path``; this argument is accepted by both the :class:`.Table` constructor as well as by the :meth:`.MetaData.reflect` method. When in use against Postgresql, a foreign-key referenced table which specifies a remote schema name will retain that schema name even if the name is present in the ``search_path``; the default behavior since 0.7.3 has been that schemas present in ``search_path`` would not be copied to reflected :class:`.ForeignKey` objects. The documentation has been updated to describe in detail the behavior of the ``pg_get_constraintdef()`` function and how the ``postgresql_ignore_search_path`` feature essentially determines if we will honor the schema qualification reported by this function or not. [ticket:2922]
* - The behavior of :meth:`.Table.tometadata` has been adjusted such thatMike Bayer2014-02-021-18/+67
| | | | | | | | | | | | | | | | | | | | | | | | the schema target of a :class:`.ForeignKey` will not be changed unless that schema matches that of the parent table. That is, if a table "schema_a.user" has a foreign key to "schema_b.order.id", the "schema_b" target will be maintained whether or not the "schema" argument is passed to :meth:`.Table.tometadata`. However if a table "schema_a.user" refers to "schema_a.order.id", the presence of "schema_a" will be updated on both the parent and referred tables. This is a behavioral change hence isn't likely to be backported to 0.8; it is assumed that the previous behavior is pretty buggy however and that it's unlikely anyone was relying upon it. Additionally, a new parameter has been added :paramref:`.Table.tometadata.referred_schema_fn`. This refers to a callable function which will be used to determine the new referred schema for any :class:`.ForeignKeyConstraint` encountered in the tometadata operation. This callable can be used to revert to the previous behavior or to customize how referred schemas are treated on a per-constraint basis. [ticket:2913] - rework the tests in test.sql.test_metadata, all the "tometadata" tests now under new class ToMetaDataTest
* - Fixed bug in new :class:`.TextAsFrom` construct where :class:`.Column`-Mike Bayer2014-02-022-2/+11
| | | | | | | | | | oriented row lookups were not matching up to the ad-hoc :class:`.ColumnClause` objects that :class:`.TextAsFrom` generates, thereby making it not usable as a target in :meth:`.Query.from_statement`. Also fixed :meth:`.Query.from_statement` mechanics to not mistake a :class:`.TextAsFrom` for a :class:`.Select` construct. This bug is also an 0.9 regression as the :meth:`.Text.columns` method is called to accommodate the :paramref:`.text.typemap` argument. [ticket:2932]
* - Added a new feature which allows automated naming conventions to beMike Bayer2014-02-013-8/+189
| | | | | | | | | | | | | | | | applied to :class:`.Constraint` and :class:`.Index` objects. Based on a recipe in the wiki, the new feature uses schema-events to set up names as various schema objects are associated with each other. The events then expose a configuration system through a new argument :paramref:`.MetaData.naming_convention`. This system allows production of both simple and custom naming schemes for constraints and indexes on a per-:class:`.MetaData` basis. [ticket:2923] commit 7e65e52c086652de3dd3303c723f98f09af54db8 Author: Mike Bayer <mike_mp@zzzcomputing.com> Date: Sat Feb 1 15:09:04 2014 -0500 - first pass at new naming approach
* - Added a new parameter :paramref:`.Operators.op.is_comparison`. ThisMike Bayer2014-01-311-4/+17
| | | | | | flag allows a custom op from :meth:`.Operators.op` to be considered as a "comparison" operator, thus usable for custom :paramref:`.relationship.primaryjoin` conditions.
* - Fixed bug whereby SQLite compiler failed to propagate compiler argumentsMike Bayer2014-01-312-2/+4
| | | | | | | | | | such as "literal binds" into a CAST expression. - Fixed bug whereby binary type would fail in some cases if used with a "test" dialect, such as a DefaultDialect or other dialect with no DBAPI. - Fixed bug where "literal binds" wouldn't work with a bound parameter that's a binary type. A similar, but different, issue is fixed in 0.8.