summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* restore the contracts of update/extend to the degree that the same column ↵Mike Bayer2014-02-271-0/+30
| | | | | | identity isn't appended to the list. reflection makes use of this.
* - Fixed a regression in association proxy caused by :ticket:`2810` whichMike Bayer2014-02-271-1/+31
| | | | | | | | | caused a user-provided "getter" to no longer receive values of ``None`` when fetching scalar values from a target that is non-present. The check for None introduced by this change is now moved into the default getter, so a user-provided getter will also again receive values of None. re: #2810
* - Adjusted the logic which applies names to the .c collection whenMike Bayer2014-02-262-3/+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-1/+191
| | | | | | | | | | | | | | | | | | | | | | | 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-262-0/+39
| | | | | | 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.
* - The new dialect-level keyword argument system for schema-levelMike Bayer2014-02-251-0/+133
| | | | | | | | | 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
* - Fixed bug where events set to listen at the classMike Bayer2014-02-251-5/+33
| | | | | | | | level (e.g. on the :class:`.Mapper` or :class:`.ClassManager` level, as opposed to on an individual mapped class, and also on :class:`.Connection`) that also made use of internal argument conversion (which is most within those categories) would fail to be removable. fixes #2973
* - we're testing a query here with non-standard aliasing which fails on PG ↵Mike Bayer2014-02-241-0/+6
| | | | | | | and MySQL. Leave this test in place as its ultimately a SQLite use case, but only test on SQLite. We perhaps should add another test case that works on all platforms.
* - Fixed regression from 0.8 where using an option likeMike Bayer2014-02-241-0/+14
| | | | | | | :func:`.orm.lazyload` with the "wildcard" expression, e.g. ``"*"``, would raise an assertion error in the case where the query didn't contain any actual entities. This assertion is meant for other cases and was catching this one inadvertently.
* - More fixes to SQLite "join rewriting"; the fix from :ticket:`2967`Mike Bayer2014-02-201-2/+66
| | | | | | | | | | | | | | 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.
* skip this on oracleMike Bayer2014-02-191-0/+3
|
* - re: #2967, also fixed a somewhat related issue where join rewriting would failMike Bayer2014-02-191-1/+38
| | | | | 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-4/+56
| | | | | would fail to be rewritten properly, such as when the exists is mapped to a column_property in an intricate nested-join scenario. #2967
* - Added new MySQL-specific :class:`.mysql.DATETIME` which includesMike Bayer2014-02-191-3/+24
| | | | | | | fractional seconds support; also added fractional seconds support to :class:`.mysql.TIMESTAMP`. DBAPI support is limited, though fractional seconds are known to be supported by MySQL Connector/Python. Patch courtesy Geert JM Vanderkelen. #2941
* Merge branch 'master' of https://bitbucket.org/50onred/sqlalchemy/overview ↵Mike Bayer2014-02-191-0/+30
|\ | | | | | | into t
| * Fixes MySQL dialect partitioningMarcus McCurdy2014-02-141-0/+30
| |
* | - Fixed bug where calling :meth:`.Insert.values` with an empty listMike Bayer2014-02-191-0/+23
| | | | | | | | | | or tuple would raise an IndexError. It now produces an empty insert construct as would be the case with an empty dictionary.
* | - Fixed a critical regression caused by :ticket:`2880` where the newlyMike Bayer2014-02-191-0/+38
| | | | | | | | | | | | concurrent ability to return connections from the pool means that the "first_connect" event is now no longer synchronized either, thus leading to dialect mis-configurations under even minimal concurrency situations.
* | - Support has been improved for Postgresql reflection behavior on very oldMike Bayer2014-02-184-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | (pre 8.1) versions of Postgresql, and potentially other PG engines such as Redshift (assuming Redshift reports the version as < 8.1). The query for "indexes" as well as "primary keys" relies upon inspecting a so-called "int2vector" datatype, which refuses to coerce to an array prior to 8.1 causing failures regarding the "ANY()" operator used in the query. Extensive googling has located the very hacky, but recommended-by-PG-core-developer query to use when PG version < 8.1 is in use, so index and primary key constraint reflection now work on these versions.
* | - dont need this import and it's not in 2.6 anywayMike Bayer2014-02-171-1/+0
| |
* | - rewrite SQLite reflection tests into one consistent fixture, which testsMike Bayer2014-02-161-159/+144
| | | | | | | | both _resolve_type_affinity() directly as well as round trip tests fully.
* | - The SQLite dialect will now skip unsupported arguments when reflectingMike Bayer2014-02-161-4/+16
| | | | | | | | | | | | types; such as if it encounters a string like ``INTEGER(5)``, the :class:`.INTEGER` type will be instantiated without the "5" being included, based on detecting a ``TypeError`` on the first attempt.
* | Merge branch 'master' of https://github.com/eblume/sqlalchemy into tMike Bayer2014-02-162-7/+71
|\ \ | |/ |/|
| * SQLite dialect - support relection from affinitypr/65Erich Blume2014-02-032-7/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQLite allows column types that aren't technically understood in sqlite by using 'data affinity', which is an algorithm for converting column types in to some sort of useful type that can be stored and retrieved from the db. Unfortunatly, this breaks reflection since we (previously) expected a sqlite db to reflect column types that we permit in the `ischema_names` for that dialect. This patch changes the logic for 'unknown' column types during reflection to instead run through SQLite's data affinity algorithm, and assigns appropriate types from that. It also expands the matching for column type to include column types with spaces (strongly discouraged but allowed by sqlite) and also completely empty column types (in which case the NullType is assigned, which sqlite will treat as a Blob - or rather, Blob is treated as NullType). These changes mean that SQLite will never raise an error for an unknown type during reflection - there will always be some 'useful' type returned, which follows the spirit of SQLite (accomodation before sanity!).
* | - Fixed bug where :meth:`.in_()` would go into an endless loop ifMike Bayer2014-02-131-0/+33
| | | | | | | | | | | | erroneously passed a column expression whose comparator included the ``__getitem__()`` method, such as a column that uses the :class:`.postgresql.ARRAY` type. [ticket:2957]
* | - Fixed bug where :class:`.AbstractConcreteBase` would fail to beMike Bayer2014-02-111-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fully usable within declarative relationship configuration, as its string classname would not be available in the registry of classnames at mapper configuration time. The class now explicitly adds itself to the class regsitry, and additionally both :class:`.AbstractConcreteBase` as well as :class:`.ConcreteBase` set themselves up *before* mappers are configured within the :func:`.configure_mappers` setup, using the new :meth:`.MapperEvents.before_configured` event. [ticket:2950] - Added new :meth:`.MapperEvents.before_configured` event which allows an event at the start of :func:`.configure_mappers`, as well as ``__declare_first__()`` hook within declarative to complement ``__declare_last__()``. - modified how after_configured is invoked; we just make a dispatch() not actually connected to any mapper. this makes it easier to also invoke before_configured correctly. - improved the ComparableEntity fixture to handle collections that are sets.
* | - for TextAsFrom, put the "inner" columns in the result map directly.Mike Bayer2014-02-102-5/+141
| | | | | | | | | | | | | | 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].
* | - dont need these extra conditions from the previous testMike Bayer2014-02-101-5/+0
| |
* | - Fixed bug where :meth:`.Query.get` would fail to consistentlyMike Bayer2014-02-101-0/+18
| | | | | | | | | | | | raise the :class:`.InvalidRequestError` that invokes when called on a query with existing criterion, when the given identity is already present in the identity map. [ticket:2951]
* | - Fixed an 0.9 regression where ORM instance or mapper events appliedMike Bayer2014-02-091-0/+57
| | | | | | | | | | | | | | | | to a base class such as a declarative base with the propagate=True flag would fail to apply to existing mapped classes which also used inheritance due to an assertion. Addtionally, repaired an attribute error which could occur during removal of such an event, depending on how it was first assigned. [ticket:2949]
* | - Fixed bug where the :class:`.AutomapBase` class of theMike Bayer2014-02-081-0/+65
| | | | | | | | | | | | | | new automap extension would fail if classes were pre-arranged in single or potentially joined inheritance patterns. The repaired joined inheritance issue could also potentially apply when using :class:`.DeferredReflection` as well.
* | - More issues with [ticket:2932] first resolved in 0.9.2 whereMike Bayer2014-02-051-0/+30
| | | | | | | | | | | | | | | | | | | | 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]
* | - Fixed regression in new "naming convention" feature where conventionsMike Bayer2014-02-051-2/+20
| | | | | | | | | | would fail if the referred table in a foreign key contained a schema name. Pull request courtesy Thomas Farvour. pullreq github:67
* | - Fixed bug where so-called "literal render" of :func:`.bindparam`Mike Bayer2014-02-051-0/+7
| | | | | | | | | | | | 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.
* | - Improved the initialization logic of composite attributes such thatMike Bayer2014-02-031-0/+13
| | | | | | | | | | | | calling ``MyClass.attribute`` will not require that the configure mappers step has occurred, e.g. it will just work without throwing any error. [ticket:2935]
* | - Added :paramref:`.MetaData.reflect.**dialect_kwargs`Mike Bayer2014-02-021-88/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* | - use from_statement() for the ORM column testMike Bayer2014-02-021-8/+7
| | | | | | | | - with select_from(), add external order by so that Oracle orders correctly
* | - The behavior of :meth:`.Table.tometadata` has been adjusted such thatMike Bayer2014-02-021-168/+308
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+83
| | | | | | | | | | | | | | | | | | | | 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-012-13/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | add a skip for oracle on thisMike Bayer2014-02-012-0/+22
| |
* | - Added a new directive used within the scope of an attribute "set" operationMike Bayer2014-01-311-0/+51
| | | | | | | | | | | | | | | | to disable autoflush, in the case that the attribute needs to lazy-load the "old" value, as in when replacing one-to-one values or some kinds of many-to-one. A flush at this point otherwise occurs at the point that the attribute is None and can cause NULL violations. [ticket:2921]
* | - Added a new parameter :paramref:`.Operators.op.is_comparison`. ThisMike Bayer2014-01-312-0/+49
| | | | | | | | | | | | 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-0/+17
|/ | | | | | | | | | 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-292-0/+19
| | | | | | | 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]
* - better way to do itMike Bayer2014-01-291-2/+4
|
* - add TypeError handling to the tests here, ensure TypeErrorMike Bayer2014-01-291-8/+15
| | | | | for the control is a TypeError for the row, as is raised on py3k when less/greater operators are used on incompatible types
* - Fixed 0.9 regression where the new sortable support for :class:`.RowProxy`Mike Bayer2014-01-281-1/+25
| | | | | | | | | would lead to ``TypeError`` when compared to non-tuple types as it attempted to apply tuple() to the "other" object unconditionally. The full range of Python comparison operators have now been implemented on :class:`.RowProxy`, using an approach that guarantees a comparison system that is equivalent to that of a tuple, and the "other" object is only coerced if it's an instance of RowProxy. [ticket:2924]
* - repair the fixture/test here to make sure state isn't left over causing ↵Mike Bayer2014-01-271-1/+1
| | | | other tests to fail
* - Fixed an 0.9 regression where the automatic aliasing applied byMike Bayer2014-01-232-0/+59
| | | | | | | | | | :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]