summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
Commit message (Collapse)AuthorAgeFilesLines
* 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 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.
* - Fixed regression whereby the "annotation" system used by the ORM was leakingMike Bayer2014-01-291-9/+9
| | | | | | | into the names used by standard functions in :mod:`sqlalchemy.sql.functions`, such as ``func.coalesce()`` and ``func.max()``. Using these functions in ORM attributes and thus producing annotated versions of them could corrupt the actual function name rendered in the SQL. [ticket:2927]
* - docsMike Bayer2014-01-261-37/+115
|
* updatesMike Bayer2014-01-261-52/+87
|
* tweak textMike Bayer2014-01-251-2/+16
|
* seealsos in the tutorialMike Bayer2014-01-251-0/+4
|
* caseMike Bayer2014-01-251-47/+139
|
* - start building out very comprehensive docstrings for core functionsMike Bayer2014-01-252-103/+459
|
* lets document join()Mike Bayer2014-01-241-20/+94
|
* - Fixed an 0.9 regression where the automatic aliasing applied byMike Bayer2014-01-231-2/+11
| | | | | | | | | | :class:`.Query` and in other situations where selects or joins were aliased (such as joined table inheritance) could fail if a user-defined :class:`.Column` subclass were used in the expression. In this case, the subclass would fail to propagate ORM-specific "annotations" along needed by the adaptation. The "expression annotations" system has been corrected to account for this case. [ticket:2918]
* - update docs for Numeric/Float, in particular warn against using mismatchedMike Bayer2014-01-211-32/+41
| | | | types (e.g. [ticket:2916])
* - Fixed the multiple-table "UPDATE..FROM" construct, only usable onMike Bayer2014-01-201-30/+80
| | | | | | | | | | | MySQL, to correctly render the SET clause among multiple columns with the same name across tables. This also changes the name used for the bound parameter in the SET clause to "<tablename>_<colname>" for the non-primary table only; as this parameter is typically specified using the :class:`.Column` object directly this should not have an impact on applications. The fix takes effect for both :meth:`.Table.update` as well as :meth:`.Query.update` in the ORM. [ticket:2912]
* - further refine this so that the ordering of columns is maintained asMike Bayer2014-01-201-8/+17
| | | | | sent to the primary key constraint; existing tests in the PG dialect confirm this.
* - simplify the mechanics of PrimaryKeyConstraint with regards to reflection;Mike Bayer2014-01-201-13/+105
| | | | | | | | | | | | reflection now updates the PKC in place. - support the use case of the empty PrimaryKeyConstraint in order to specify constraint options; the columns marked as primary_key=True will now be gathered into the columns collection, rather than being ignored. [ticket:2910] - add validation such that column specification should only take place in the PrimaryKeyConstraint directly, or by using primary_key=True flags; if both are present, they have to match exactly, otherwise the condition is assumed to be ambiguous, and a warning is emitted; the old behavior of using the PKC columns only is maintained.
* - alter behavior such that dialect_kwargs is still immutable, butMike Bayer2014-01-191-10/+5
| | | | | | now represents exactly the kwargs that were passed, and not the defaults. the defaults are still in dialect_options. This allows repr() schemes such as that of alembic to not need to look through and compare for defaults.
* - implement kwarg validation and type system for dialect-specificMike Bayer2014-01-183-45/+183
| | | | | arguments; [ticket:2866] - add dialect specific kwarg functionality to ForeignKeyConstraint, ForeignKey
* Merge branch 'patch-msql-pkc-clustered' of bitbucket.org:dharland/sqlalchemy ↵Mike Bayer2014-01-181-0/+2
|\ | | | | | | into m
| * Bug Fix: Stop generating bad sql if an empty UniqueConstraint() is givendonkopotamus2014-01-171-0/+2
| |
* | - rework Oracle to no longer do its own unicode conversion; this has been ↵Mike Bayer2014-01-171-13/+4
|/ | | | | | | | | | | observed to be very slow. this now has the effect of producing "conditional" unicode conversion for the Oracle backend, as it still returns NVARCHAR etc. as unicode [ticket:2911] - add new "conditional" functionality to unicode processors; the C-level function now uses PyUnicode_Check() as a fast alternative to the isinstance() check in Python
* - happy new yearMike Bayer2014-01-0517-17/+17
|