Commit Graph

4614 Commits

Author SHA1 Message Date
Mike Bayer 8daa6ccfb0 - The `__mapper_args__` dictionary is copied from a declarative
mixin or abstract class when accessed, so that modifications made
to this dictionary by declarative itself won't conflict with that
of other mappings.  The dictionary is modified regarding the
``version_id_col`` and ``polymorphic_on`` arguments, replacing the
column within with the one that is officially mapped to the local
class/table. fixes #3062
2014-05-30 15:36:13 -04:00
Mike Bayer f000161f24 Merge branch 'master' of https://github.com/tlocke/sqlalchemy into tlocke-master 2014-05-30 12:08:26 -04:00
Mike Bayer 69dbcdd0eb - Related to 🎫3060, an adjustment has been made to the unit
of work such that loading for related many-to-one objects is slightly
more aggressive, in the case of a graph of self-referential objects
that are to be deleted; the load of related objects is to help
determine the correct order for deletion if passive_deletes is
not set.
- revert the changes to test_delete_unloaded_m2o, these deletes do in fact
need to occur in the order of the two child objects first.
2014-05-30 01:32:53 -04:00
Mike Bayer 2c8689fd14 - add a new assertsql construct "Or", so that we can test for a UOW flush
that might take one of multiple directions; apply this to test_delete_unloaded_m2o
which is now illustrating multiple paths due to #3060/#3061, though still doing the
right thing.
2014-05-30 00:21:11 -04:00
Mike Bayer 752f2e0fc8 - Adjustment to attribute mechanics concerning when a value is
implicitly initialized to None via first access; this action,
which has always resulted in a population of the attribute,
now emits an attribute event just like any other attribute set
operation and generates the same kind of history as one.  Additionally,
many mapper internal operations will no longer implicitly generate
these "None" values when various never-set attributes are checked.
These are subtle behavioral fixes to attribute mechanics which provide
a better solution to the problem of 🎫`3060`, which also
involves recognition of attributes explicitly set to ``None``
vs. attributes that were never set.
fixes #3061
2014-05-29 19:54:51 -04:00
Mike Bayer bc08ee9029 - Fixed a few edge cases which arise in the so-called "row switch"
scenario, where an INSERT/DELETE can be turned into an UPDATE.
In this situation, a many-to-one relationship set to None, or
in some cases a scalar attribute set to None, may not be detected
as a net change in value, and therefore the UPDATE would not reset
what was on the previous row.   This is due to some as-yet
unresovled side effects of the way attribute history works in terms
of implicitly assuming None isn't really a "change" for a previously
un-set attribute.  See also 🎫`3061`. fixes #3060
2014-05-28 20:01:21 -04:00
Mike Bayer 482a67e1c6 - Fixed bug in INSERT..FROM SELECT construct where selecting from a
UNION would wrap the union in an anonymous (e.g. unlabled) subquery.
fixes #3044
2014-05-25 14:08:41 -04:00
Mike Bayer e384347ffb - Added the `hashable=False flag to the PG :class:.HSTORE` type, which
is needed to allow the ORM to skip over trying to "hash" an ORM-mapped
HSTORE column when requesting it in a mixed column/entity list.
Patch courtesy Gunnlaugur Þór Briem.  Fixes #3053
2014-05-25 13:58:08 -04:00
Mike Bayer 95b10c4e8e - Fixed bug in subquery eager loading where a long chain of
eager loads across a polymorphic-subclass boundary in conjunction
with polymorphic loading would fail to locate the subclass-link in the
chain, erroring out with a missing property name on an
:class:`.AliasedClass`. fixes #3055
2014-05-25 13:45:32 -04:00
Mike Bayer e6cbd88fe1 - Fixed bug in SQLite join rewriting where anonymized column names
due to repeats would not correctly be rewritten in subqueries.
This would affect SELECT queries with any kind of subquery + join.
fixes #3057
2014-05-25 11:32:07 -04:00
Mike Bayer 8a4f75e972 - repair oracle compilation for new limit/offset system. 2014-05-24 21:45:15 -04:00
Mike Bayer e41af7fcfd - reset callcounts 2014-05-24 16:49:25 -04:00
Mike Bayer 4d4abd2f76 - revert the memoized committed_state / callables changes as they appear to add to lazy loading.
not really clear which approach is better in the long run.
2014-05-24 16:28:23 -04:00
Mike Bayer 6126caec44 - fix typos in test
- restore __len__ to identity map
2014-05-24 14:54:07 -04:00
Mike Bayer d1705a46fe - Fixed bug where the :meth:.Operators.__and__,
:meth:`.Operators.__or__` and :meth:`.Operators.__invert__`
operator overload methods could not be overridden within a custom
:class:`.TypeEngine.Comparator` implementation.
fixes #3012
2014-05-24 14:35:28 -04:00
Tony Locke f8f29d0a10 PEP 8 tidy of pg8000 dialect and postgresql/test_dialect.py 2014-05-22 20:36:27 +01:00
Tony Locke 66e0a7771f Autocommit isolation level for postgresql+pg8000
As with postgresql+psycopg2,
execution_options(isolation_level='AUTOCOMMIT') now works for the
postgresql+pg8000 dialect.

Also enabled the autocommit test in test_dialect.py for pg8000.
2014-05-22 20:13:10 +01:00
Tony Locke 996de05ee9 Add postgresql+pg8000 to floats_to_four_decimals
pg8000 uses binary transfer of floats and so accuracy is lost for floats
that can't be represented exactly in binary.
2014-05-21 19:17:41 +01:00
Tony Locke fc4e113cf1 pg8000 now passes test_extract() test 2014-05-21 19:17:41 +01:00
Tony Locke 30af311628 Two tests now work for pg800 in EnumTest
The two tests, test_create_table() and test_unicode_labels() previously
failed under pg8000, but now they pass, so this commit opens them up.
2014-05-21 19:17:41 +01:00
Tony Locke e36e228100 pg8000 no longer truncates decimals
We can now update the requirements to remove the special case of pg8000
truncating decimals.
2014-05-21 19:17:41 +01:00
Mike Bayer 81959af6d3 - more tests, including backend tests
- implement for SQL server, use window functions when simple limit/offset not available
2014-05-16 15:33:39 -04:00
Mike Bayer 8414c9f00b Merge branch 'issue_3034' of https://bitbucket.org/dobesv/sqlalchemy/branch/issue_3034 into ticket_3034 2014-05-16 14:45:40 -04:00
Mike Bayer 460465a874 - changelog for #2785
- refactor tests a bit
fixes #2785
2014-05-16 13:09:50 -04:00
Mike Bayer acb13668c2 Merge branch 'zero_indexes-param-for-postgresql-ARRAY-type' of https://bitbucket.org/LevonXXL/sqlalchemy/overview into t 2014-05-16 13:01:19 -04:00
Mike Bayer aa12fdb40e - Fixed bug in mutable extension where :class:.MutableDict did not
report change events for the ``setdefault()`` dictionary operation.
fixes #3051
2014-05-14 10:03:24 -04:00
Alexey Terentev 57b6da9d40 zero_indexes-param-for-postgresql-ARRAY-type 2014-05-13 15:48:29 +04:00
Mike Bayer 0a08177b59 Merged in WSMcG/sqlalchemy (pull request #15)
Added optional '=' to MySQL KEY_BLOCK_SIZE regex
2014-05-12 11:38:24 -04:00
mike bayer 1abd53a355 Merge pull request #91 from smurfix/de_apostroph_ify
Documentation fix-up: "its" vs. "it's"
2014-05-11 13:04:05 -04:00
Matthias Urlichs f341cfbfe1 Documentation fix-up: "its" vs. "it's"
Removed ungrammatical apostrophes from documentation, replacing
"it's" with "its" where appropriate (but in a few cases with "it is"
when that read better).

While doing that, I also fixed a couple of minor typos etc.
as I noticed them.
2014-05-11 16:49:56 +02:00
Mike Bayer 230c0d5a19 - Fixed ORM bug where the :func:.class_mapper function would mask
AttributeErrors or KeyErrors that should raise during mapper
configuration due to user errors.  The catch for attribute/keyerror
has been made more specific to not include the configuration step.
fixes #3047
2014-05-10 23:26:09 -04:00
Mike Bayer 168ca1d37d - stress test for invalidation 2014-05-10 15:52:31 -04:00
Mike Bayer 55eacc8dbe - Fixed bug where :meth:.Table.update and :meth:.Table.delete
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
2014-05-08 22:44:06 -04:00
Mike Bayer c8873b31f0 - critically, py.test for unknown reasons *SKIPS* tests that have an __init__() method.
No clue.  nosetests doesn't do this.  concerning that other tests might have the same issue.
2014-05-02 18:43:12 -04:00
Mike Bayer 2a458680a4 - Fixed bug where the combination of "limit" rendering as
"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
2014-04-30 19:07:45 -04:00
Alex Gaynor 1caa7fafbd Fix many typos throughout the codebase
Found using: https://github.com/intgr/topy
2014-04-26 13:13:13 -07:00
Dobes Vandermeer 624924d5e7 Expand test to also test whether offset accepts a bindparam. 2014-04-24 15:33:53 -07:00
Dobes Vandermeer 338ca8e488 Proof-of-concept implementation of supporting bindparam for offset and limit on a query. 2014-04-24 15:20:57 -07:00
Mike Bayer 7303b59b00 - The "primaryjoin" model has been stretched a bit further to allow
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
2014-04-19 18:49:58 -04:00
Mike Bayer c33d037880 - Liberalized the contract for :class:.Index a bit in that you can
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
2014-04-19 12:31:19 -04:00
W. Sean McGivern c5a95ea8e3 Added optional '=' to MySQL KEY_BLOCK_SIZE regex 2014-04-19 12:16:46 -04:00
Mike Bayer 99ae0dc821 - Fixed bug in new :meth:.DialectKWArgs.argument_for method where
adding an argument for a construct not previously included for any
special arguments would fail. fixes #3024
2014-04-15 23:34:07 -04:00
Matt Chisholm f0d71dc2d6 remove unused import 2014-04-14 13:53:28 -04:00
Matt Chisholm 3cefa27709 fix unclosed file ResourceWarning
part of #2830
2014-04-14 13:27:59 -04:00
Mike Bayer fcda519452 - Fixed regression introduced in 0.9 where new "ORDER BY <labelname>"
feature from 🎫`1068` would not apply quoting rules to the
label name as rendered in the ORDER BY.
fix #3020, re: #1068
2014-04-10 22:33:33 -04:00
Mike Bayer 9f74861d6d - Added new utility function :func:.make_transient_to_detached which can
be used to manufacture objects that behave as though they were loaded
from a session, then detached.   Attributes that aren't present
are marked as expired, and the object can be added to a Session
where it will act like a persistent one. fix #3017
2014-04-09 17:49:16 -04:00
Mike Bayer b23bb79581 - reverse order of columns in sample CTEs as this is a UNION and the cols 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
2014-04-02 18:11:11 -04:00
Mike Bayer 66f2e1257a - back off the callcounts a bit for the boolean fix
- rewrite callcounts for select()
2014-04-01 18:29:54 -04:00
Mike Bayer 2e5c8913a8 - Fixes to the newly enhanced boolean coercion in 🎫2804 where
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
2014-04-01 13:03:52 -04:00
Mike Bayer e16ede8cae - Added new flag :paramref:.expression.between.symmetric, when set to True
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
2014-03-30 21:20:20 -04:00