Commit Graph

350 Commits

Author SHA1 Message Date
Mike Bayer ee88e648f7 - Fixed bug where the :class:.AutomapBase class of the
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.
2014-02-08 21:24:13 -05:00
Mike Bayer 743ceb045e - Support is improved for supplying a :func:.join construct as the
target of :paramref:`.relationship.secondary` for the purposes
of creating very complex :func:`.relationship` join conditions.
The change includes adjustments to query joining, joined eager loading
to not render a SELECT subquery, changes to lazy loading such that
the "secondary" target is properly included in the SELECT, and
changes to declarative to better support specification of a
join() object with classes as targets.
2014-01-22 20:16:47 -05:00
Mike Bayer 21bc2c2a5b - docs + tests 2014-01-05 16:48:01 -05:00
Mike Bayer 3182101127 - Fixed an extremely unlikely memory issue where when using
:class:`.DeferredReflection`
to define classes pending for reflection, if some subset of those
classes were discarded before the :meth:`.DeferredReflection.prepare`
method were called to reflect and map the class, a strong reference
to the class would remain held within the declarative internals.
This internal collection of "classes to map" now uses weak
references against the classes themselves.
2014-01-03 21:46:13 -05:00
Mike Bayer 8a7fdd4e5c - A quasi-regression where apparently in 0.8 you can set a class-level
attribute on declarative to simply refer directly to an :class:`.InstrumentedAttribute`
on a superclass or on the class itself, and it
acts more or less like a synonym; in 0.9, this fails to set up enough
bookkeeping to keep up with the more liberalized backref logic
from 🎫`2789`.  Even though this use case was never directly
considered, it is now detected by declarative at the "setattr()" level
as well as when setting up a subclass, and the mirrored/renamed attribute
is now set up as a :func:`.synonym` instead. [ticket:2900]
2014-01-02 18:51:49 -05:00
Mike Bayer de786a4208 - Declarative does an extra check to detect if the same
:class:`.Column` is mapped multiple times under different properties
(which typically should be a :func:`.synonym` instead) or if two
or more :class:`.Column` objects are given the same name, raising
a warning if this condition is detected. [ticket:2828]
2013-12-27 17:10:55 -05:00
Mike Bayer ace7bdbc78 - Error message when a string arg sent to :func:.relationship which
doesn't resolve to a class or mapper has been corrected to work
the same way as when a non-string arg is received, which indicates
the name of the relationship which had the configurational error.
[ticket:2888]
2013-12-12 12:49:57 -05:00
Mike Bayer 36e1aa0afd - The :class:.DeferredReflection class has been enhanced to provide
automatic reflection support for the "secondary" table referred
to by a :func:`.relationship`.   "secondary", when specified
either as a string table name, or as a :class:`.Table` object with
only a name and :class:`.MetaData` object will also be included
in the reflection process when :meth:`.DeferredReflection.prepare`
is called. [ticket:2865]
- clsregistry._resolver() now uses a stateful _class_resolver()
class in order to handle the work of mapping strings to
objects.   This is to provide for simpler extensibility, namely
a ._resolvers collection of ad-hoc name resolution functions;
the DeferredReflection class adds its own resolver here in order
to handle relationship(secondary) names which generate new
Table objects.
2013-12-03 13:46:41 -05:00
Mike Bayer e6f67f4805 Fixed bug where in Py2K a unicode literal would not be accepted
as the string name of a class or other argument within
declarative using :func:`.relationship`.
2013-11-29 18:15:52 -05:00
Mike Bayer 2aa00c49d7 - Fixed bug which prevented the `serializer` extension from working
correctly with table or column names that contain non-ASCII
characters. [ticket:2869]
2013-11-21 13:30:32 -05:00
Mike Bayer 91ae63569d - catch the metadata on ScalarTest.test_scalar_proxy, this has been leaving itself
around for a long time
- association proxy now returns None for proxied scalar that is also None, rather
than raising AttributeError. [ticket:2810]
2013-10-25 17:56:53 -04:00
Mike Bayer 461791fb54 - just comment out this test, we may have to figure out if the whole
"serializer" can just be ditched, or if somehow these deterministic issues
can be fixed (everyone implements __reduce__ maybe?)
2013-10-21 23:28:19 -04:00
Mike Bayer 08a6a8b519 - Removed some now unneeded version checks [ticket:2829] courtesy alex gaynor 2013-09-22 20:35:40 -04:00
Mike Bayer 031ef08078 - A rework to the way that "quoted" identifiers are handled, in that
instead of relying upon various ``quote=True`` flags being passed around,
these flags are converted into rich string objects with quoting information
included at the point at which they are passed to common schema constructs
like :class:`.Table`, :class:`.Column`, etc.   This solves the issue
of various methods that don't correctly honor the "quote" flag such
as :meth:`.Engine.has_table` and related methods.  The :class:`.quoted_name`
object is a string subclass that can also be used explicitly if needed;
the object will hold onto the quoting preferences passed and will
also bypass the "name normalization" performed by dialects that
standardize on uppercase symbols, such as Oracle, Firebird and DB2.
The upshot is that the "uppercase" backends can now work with force-quoted
names, such as lowercase-quoted names and new reserved words.
[ticket:2812]
2013-08-27 20:43:22 -04:00
Mike Bayer 99732dd29b correct for missing fail() methods which were lost when we removed unittest.TestCase 2013-08-26 12:30:33 -04:00
Mike Bayer 938a8eb403 clean up formatting and other linting issues 2013-08-26 12:29:27 -04:00
Mike Bayer e9b2e33f15 - The :class:.CreateColumn construct can be appled to a custom
compilation rule which allows skipping of columns, by producing
a rule that returns ``None``.  Also in 0.8.3.
2013-08-24 13:56:01 -04:00
Mike Bayer 59141d360e - apply an import refactoring to the ORM as well
- rework the event system so that event modules load after their
targets, dependencies are reversed
- create an improved strategy lookup system for the ORM
- rework the ORM to have very few import cycles
- move out "importlater" to just util.dependency
- other tricks to cross-populate modules in as clear a way as possible
2013-08-14 19:58:34 -04:00
Mike Bayer 268d4cfcb1 - after discussions with the original project folks working with zope security
proxies, they aren't overriding getattr() or setattr() at all.  so all the
hardcoded getattr()/setattr() is removed from collections.py.   Lots of these
getattr/setattr were against the attributeimpl and decorated functions
and don't seem like they'd ever be needed; for a user that needs special access
to a collection, we can evaulate that use case and add a single point of
"unwrapping", and probably add a hook for it via
InstrumentationManager so that the collection implementation isn't complicated
by it.
2013-08-02 18:21:02 -04:00
Mike Bayer 0e219f2eff ORM descriptors such as hybrid properties can now be referenced
by name in a string argument used with ``order_by``,
``primaryjoin``, or similar in :func:`.relationship`,
in addition to column-bound attributes. [ticket:2761]
2013-07-02 18:02:20 -04:00
Mike Bayer 786c5fe316 - add a test for pullreq 8
- simplify
2013-06-23 17:53:49 -04:00
Mike Bayer 247c0471c7 turn this requirement back down as the simpler serialize works better now 2013-06-17 19:46:07 -04:00
Mike Bayer 9d3e220636 - skip this test for py3k. serializer kind of a bust 2013-06-14 18:34:01 -04:00
Mike Bayer a341e1ccc9 also clarified the changelog regarding Cls.scalar != 'value' 2013-06-08 13:39:20 -04:00
Mike Bayer 20d1e9c3fa Added additional criterion to the ==, != comparators, used with
scalar values, for comparisons to None to also take into account
the association record itself being non-present, in addition to the
existing test for the scalar endpoint on the association record
being NULL.  Previously, comparing ``Cls.scalar == None`` would return
records for which ``Cls.associated`` were present and
``Cls.associated.scalar`` is None, but not rows for which
``Cls.associated`` is non-present.  More significantly, the
inverse operation ``Cls.scalar != None`` *would* return ``Cls``
rows for which ``Cls.associated`` was non-present.

Additionally, added a special use case where you
can call ``Cls.scalar.has()`` with no arguments,
when ``Cls.scalar`` is a column-based value - this returns whether or
not ``Cls.associated`` has any rows present, regardless of whether
or not ``Cls.associated.scalar`` is NULL or not.
[ticket:2751]
2013-06-08 13:23:15 -04:00
Mike Bayer 3a13047fb0 Fixed bug where :class:.MutableDict didn't report a change event
when ``clear()`` was called.
[ticket:2730]
2013-06-03 18:23:23 -04:00
Mike Bayer 00f2b19a55 extension tests 2013-05-26 13:09:05 -04:00
Mike Bayer 956c144c7f fix serializer tests. something is wrong with non-C pickle but for some reason py3k's pickle seems to be OK? not sure why that is, as this
is all related to http://bugs.python.org/issue998998
2013-05-26 13:08:24 -04:00
Mike Bayer a6825ff019 merge default 2013-05-01 10:10:09 -04:00
Mike Bayer 138a8ebfa2 - disable tests failing with pypy2, [ticket:2719] 2013-05-01 10:09:34 -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 e3a7015f89 Fixes to the `sqlalchemy.ext.serializer` extension, including
that the "id" passed from the pickler is turned into a string
to prevent against bytes being parsed on Py3K, as well as that
``relationship()`` and ``orm.join()`` constructs are now properly
serialized. [ticket:2698] and some other observed issues.
2013-04-26 15:51:29 -04:00
Mike Bayer b25e11f6a8 formatting 2013-04-24 17:49:24 -04:00
Mike Bayer 6ae1e89961 - these pickle the assoc proxy by itself tests can't really pass
now without strong ref on the parent
- fix message compare for py3k
2013-04-20 05:34:40 -04:00
Mike Bayer d84ae4f754 Fixed indirect regression regarding :func:.has_inherited_table,
where since it considers the current class' ``__table__``, was
sensitive to when it was called.  This is 0.7's behavior also,
but in 0.7 things tended to "work out" within events like
``__mapper_args__()``.  :func:`.has_inherited_table` now only
considers superclasses, so should return the same answer
regarding the current class no matter when it's called
(obviously assuming the state of the superclass).
[ticket:2656]
2013-04-09 14:21:40 -04:00
Mike Bayer 98fea3e3dc skip this test for PG, jenkins having failures only when the full suite is run 2013-03-02 17:56:49 -05:00
Mike Bayer d89d71d1da The :class:.MutableComposite type did not allow for the
:meth:`.MutableBase.coerce` method to be used, even though
the code seemed to indicate this intent, so this now works
and a brief example is added.  As a side-effect,
the mechanics of this event handler have been changed so that
new :class:`.MutableComposite` types no longer add per-type
global event handlers.  Also in 0.7.10

[ticket:2624]
2012-12-03 19:49:42 -05:00
Mike Bayer dda33be687 cleanup 2012-12-03 19:01:25 -05:00
Richard Mitchell 92535b4b57 Allow use of synonyms in primaryjoin / secondaryjoin conditions 2012-11-27 14:03:42 +00:00
Mike Bayer 4356741c48 - hstore adjustments 2012-11-17 20:45:17 -05:00
Mike Bayer 63a9d80f18 - store only MultipleClassMarkers inside of ModuleMarker, then
store ModuleMarkers for multiple roots, one for each token in a
module path.  this allows partial path resolution.
- docs to this effect
2012-10-28 14:15:56 -04:00
Mike Bayer bac14cdf47 Added a new method :meth:.Engine.execution_options
to :class:`.Engine`.  This method works similarly to
      :class:`.Connection.execution_options` in that it creates
      a copy of the parent object which will refer to the new
      set of options.   The method can be used to build
      sharding schemes where each engine shares the same
      underlying pool of connections.   The method
      has been tested against the horizontal shard
      recipe in the ORM as well.
2012-10-23 12:08:20 -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 7e815c67a9 finished fixes for mxodbc; need to use at least version 3.2.1 2012-09-21 17:43:22 -04:00
Mike Bayer 062f0a202a - [bug] Fixed a disconnect that slowly evolved
between a @declared_attr Column and a
directly-defined Column on a mixin. In both
cases, the Column will be applied to the
declared class' table, but not to that of a
joined inheritance subclass.   Previously,
the directly-defined Column would be placed
on both the base and the sub table, which isn't
typically what's desired.  [ticket:2565]
2012-09-14 21:58:19 -04:00
Mike Bayer 1c325dc9c7 - [feature] Added a hook to the system of rendering
CREATE TABLE that provides access to the render for each
Column individually, by constructing a @compiles
function against the new schema.CreateColumn
construct.  [ticket:2463]
2012-09-09 14:39:25 -04:00
Mike Bayer df7a3792f5 - add req's for predictable gc 2012-09-05 12:46:28 -04:00
Mike Bayer 28be45cb54 oops, one more 2012-08-29 17:29:08 -04:00
Mike Bayer 561c71ff55 - skip this on oracle 2012-08-29 16:25:20 -04:00
Mike Bayer 656cb6461b - [feature] declared_attr can now be used with
attributes that are not Column or MapperProperty;
including any user-defined value as well
as association proxy objects.  [ticket:2517]
2012-08-27 16:44:34 -04:00