Commit Graph

81 Commits

Author SHA1 Message Date
Mike Bayer 4d6f4ed184 - Fixed 1.0 regression where a "deferred" attribute would not populate
correctly if it were loaded within the "optimized inheritance load",
which is a special SELECT emitted in the case of joined table
inheritance used to populate expired or unloaded attributes against
a joined table without loading the base table.  This is related to
the fact that SQLA 1.0 no longer guesses about loading deferred
columns and must be directed explicitly.
fixes #3468
2015-06-29 13:49:44 -04:00
Mike Bayer 20e64ad6b8 - use new Or() directive to test for both SQL variants here, which can vary
based on hash ordering of the ClassManager
2014-06-21 20:27:19 -04:00
Mike Bayer a1bbf3a005 - Additional checks have been added for the case where an inheriting
mapper is implicitly combining one of its column-based attributes
with that of the parent, where those columns normally don't necessarily
share the same value.  This is an extension of an existing check that
was added via 🎫`1892`; however this new check emits only a
warning, instead of an exception, to allow for applications that may
be relying upon the existing behavior.
fixes #3042
2014-06-20 18:47:28 -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
Mike Bayer 59ca4633ac - remove informix dialect, moved out to https://bitbucket.org/zzzeek/sqlalchemy_informixdb
- remove informix, maxdb, access symbols from tests etc.
2013-11-17 13:45:23 -05:00
Mike Bayer 715d6cf3d1 - additional fix for [ticket:2750] where on an update, we make sure the
value is present
2013-06-30 15:58:50 -04:00
Mike Bayer 6ece305692 add better tests for [ticket:2750] 2013-06-30 11:21:43 -04:00
Mike Bayer 3b24ccaf28 A warning is emitted when trying to flush an object of an inherited
mapped class where the polymorphic discriminator has been assigned
to a value that is invalid for the class.   [ticket:2750]
2013-06-30 11:09:37 -04:00
Mike Bayer e288aff8ea The resolution of :class:.ForeignKey objects to their
target :class:`.Column` has been reworked to be as
immediate as possible, based on the moment that the
target :class:`.Column` is associated with the same
:class:`.MetaData` as this :class:`.ForeignKey`, rather
than waiting for the first time a join is constructed,
or similar. This along with other improvements allows
earlier detection of some foreign key configuration
issues.  Also included here is a rework of the
type-propagation system, so that
it should be reliable now to set the type as ``None``
on any :class:`.Column` that refers to another via
:class:`.ForeignKey` - the type will be copied from the
target column as soon as that other column is associated,
and now works for composite foreign keys as well.
[ticket:1765]
2013-06-23 15:58:07 -04:00
Mike Bayer 4b614b9b35 - the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
2013-04-27 19:53:57 -04:00
Mike Bayer 666fda3c9c order the properties here to get the SQL to be deterministic 2013-04-20 11:44:27 -04:00
Mike Bayer ce5cff151a Fixed bug whereby ORM would run the wrong kind of
query when refreshing an inheritance-mapped class
where the superclass was mapped to a non-Table
object, like a custom join() or a select(),
running a query that assumed a hierarchy that's
mapped to individual Table-per-class.
[ticket:2697]
2013-04-11 20:04:57 -04:00
Mike Bayer 82b6e07492 - Fixed bug in unit of work whereby a joined-inheritance
subclass could insert the row for the "sub" table
  before the parent table, if the two tables had no
  ForeignKey constraints set up between them.
  Also in 0.7.11. [ticket:2689]
- fix a glitch in the assertsql.CompiledSQL fixture regarding
when a multiparam compiledSQL is used within an AllOf
- add a new utility function randomize_unitofwork() which
does the function of --reversetop
2013-04-01 13:37:35 -04:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
become an externally usable package but still remains within the main sqlalchemy parent package.
in this system, we use kind of an ugly hack to get the noseplugin imported outside of the
"sqlalchemy" package, while still making it available within sqlalchemy for usage by
third party libraries.
2012-09-27 02:37:33 -04:00
Mike Bayer 752750ea7e - fix for pypy
- more oracle fixes
2012-08-25 13:30:58 -04:00
Mike Bayer 885cae7998 a few oracle fixes 2012-08-25 12:00:11 -04:00
Mike Bayer b99480aac2 - [bug] with_polymorphic() produces JOINs
in the correct order and with correct inheriting
tables in the case of sending multi-level
subclasses in an arbitrary order or with
intermediary classes missing.  [ticket:1900]
2012-08-01 00:08:55 -04:00
Mike Bayer 9c0de7fcf7 - with InstanceState more public, underscore all its methods
that change object state as these aren't intended for public
use.
2012-07-18 16:43:02 -04:00
Mike Bayer aebd6c73ba pypy doesn't seem to decrement __subclasses__(), just skip for now 2012-07-17 12:09:14 -04:00
Mike Bayer 800efc7525 - [feature] *Very limited* support for
inheriting mappers to be GC'ed when the
    class itself is deferenced.  The mapper
    must not have its own table (i.e.
    single table inh only) without polymorphic
    attributes in place.
    This allows for the use case of
    creating a temporary subclass of a declarative
    mapped class, with no table or mapping
    directives of its own, to be garbage collected
    when dereferenced by a unit test.
    [ticket:2526]
2012-07-14 15:41:31 -04:00
Mike Bayer b297b40fca - [bug] ORM will perform extra effort to determine
that an FK dependency between two tables is
not significant during flush if the tables
are related via joined inheritance and the FK
dependency is not part of the inherit_condition,
saves the user a use_alter directive.
[ticket:2527]
2012-07-05 10:19:59 -04:00
Mike Bayer ff0fb31bf2 - merge attribute flag overhaul for [ticket:2358] 2012-04-23 11:45:06 -04:00
Mike Bayer 0d9a752854 modify these tests to ensure the CASE output is being used fully 2012-02-14 12:59:11 -05:00
Mike Bayer 09a503e497 - [bug] Fixed bug whereby a table-bound Column
object named "<a>_<b>" which matched a column
labeled as "<tablename>_<colname>" could match
inappropriately when targeting in a result
set row.  [ticket:2377]
- requires that we change the tuple format in RowProxy.
Makes an improvement to the cases tested against
an unpickled RowProxy as well though doesn't solve the
problem there entirely.
2012-01-22 14:04:20 -05:00
Mike Bayer 6864793d1e add autoincrement directive for oracle 2011-12-09 16:28:55 -05:00
Mike Bayer 33ddb48da4 - Standalone expressions in polymorphic_on
propagate to single-table inheritance
subclasses so that they are used in the
WHERE /JOIN clause to limit rows to that
subclass as is the usual behavior.
- make sure implicit map to polymorphic_on expr
handles creating a label().  Use an explicit name
here as _sa_polymorphic_on makes more sense when
poking around in _props.
2011-12-09 11:12:41 -05:00
Mike Bayer d1cc7e7517 - [feature] polymorphic_on now accepts many
new kinds of values:

- standalone expressions that aren't
otherwise mapped
- column_property() objects
- string names of any column_property()
or attribute name of a mapped Column

The docs include an example using
the case() construct, which is likely to be
a common constructed used here.
[ticket:2345] and part of [ticket:2238]
2011-12-09 00:56:12 -05:00
Mike Bayer ac9a007c50 - Added the same "columns-only" check to
mapper.polymorphic_on as used in
relationship.order_by, foreign_keys,
remote_side, etc.
2011-06-08 17:37:42 -04:00
Mike Bayer 9826ba73a6 - polymorphic_union() gets a "cast_nulls" option,
disables the usage of CAST when it renders
    the labeled NULL columns.  [ticket:1502]

  - polymorphic_union() renders the columns in their
    original table order, as according to the first
    table/selectable in the list of polymorphic
    unions in which they appear.  (which is itself
    an unordered mapping unless you pass an OrderedDict).
2011-05-12 12:47:09 -04:00
Mike Bayer 4bc2402cc0 - Changed the handling in determination of join
conditions such that foreign key errors are
only considered between the two given tables.
That is, t1.join(t2) will report FK errors
that involve 't1' or 't2', but anything
involving 't3' will be skipped.   This affects
join(), as well as ORM relationship and
inherit condition logic.  Will keep the more conservative
approach to [ticket:2153] in 0.6.
2011-05-07 12:52:25 -04:00
Mike Bayer 7adcb1c744 - mapper() will ignore non-configured foreign keys
to unrelated tables when determining inherit
condition between parent and child class.
This is equivalent to behavior already
applied to declarative.  [ticket:2153]
Also in 0.6.8.
2011-05-07 11:52:14 -04:00
Philip Jenvey 24e6c56da8 update warnings per zxjdbc 2011-04-23 14:15:08 -07:00
Mike Bayer 7b24e458c7 - move all the comments that got shoved below the fixture grabs back up 2011-03-27 17:19:00 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer a3083eabf4 - move all the setup_classes(cls) and setup_mappers(cls) to use a
local cls.Basic, cls.Comparable base class so that there is no ambiguity
or hash identity behaviors getting in the way of class registration.
2011-03-27 15:04:06 -04:00
Mike Bayer e3dbb87d94 - move _fixtures to work via the normal methods of _base.MappedTest, convert
all referncing tests to not use globals
- tests that deal with pickle specifically load the fixture classes
from test.lib.pickleable, which gets some more classes added
- removed weird sa05 pickling tests that don't matter
2011-03-26 20:44:47 -04:00
Mike Bayer 14a2fae239 - remove @testing.resolve_artifact_names, replace with direct attribute
access to the cls/self.tables/classes registries
- express orm/_base.py ORMTest in terms of engine/_base.py TablesTest,
factor out common steps into TablesTest, remove AltEngineTest as a
separate class.   will further consolidate these base classes
2011-03-26 19:03:11 -04:00
Mike Bayer 4f1274fc1f - Also emits the correct WHERE criterion
when using single table inheritance. [ticket:2038]
2011-02-02 19:03:20 -05:00
Mike Bayer c5b4938a9a - Fixed bug where "middle" class in a polymorphic hierarchy
would have no 'polymorphic_on' column if it didn't also
specify a 'polymorphic_identity', leading to strange
errors upon refresh, wrong class loaded when querying
from that target. [ticket:2038]
2011-02-02 18:10:07 -05:00
Mike Bayer 7ad7dde6a5 - A warning is emitted when a joined-table inheriting mapper
has no primary keys on the locally mapped table
    (but has pks on the superclass table).  [ticket:2019]
2011-01-30 14:18:01 -05:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer 5622cfd5ec callcount destructo engage 2010-12-09 19:06:22 -05:00
Mike Bayer 987828194e oracle fixes 2010-12-06 17:05:32 -05:00
Mike Bayer f1e54a69fb - merge default tip 2010-12-05 14:56:26 -05:00
Mike Bayer 1f9029597c - move topological, queue into util
- move function_named into test.lib.util
- use @decorator for all decorators in test/
2010-12-05 12:51:24 -05:00
Mike Bayer c8f8124cc9 - Backport of "optimized get" fix from 0.7,
improves the generation of joined-inheritance
"load expired row" behavior.  [ticket:1992]
2010-12-04 22:13:10 -05:00
Mike Bayer af75fdf60f - added strictness to the optimized load, [ticket:1992] 2010-12-03 18:45:42 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00
Mike Bayer ac5d11afb3 - push polymorphic_on not recognized warning to an exception, [ticket:1875] 2010-11-28 11:28:27 -05:00
Mike Bayer 52167e1c37 - Query.get() will raise if the number of params
in a composite key is too large, as well as too
small. [ticket:1977]
- the above change smoked out an old mistake in a unit test.
2010-11-28 11:10:41 -05:00