Commit Graph

4078 Commits

Author SHA1 Message Date
Mike Bayer c9125a9efd - Patched a case where query.join() would adapt the
right side to the right side of the left's join
inappropriately [ticket:1925]
2010-09-21 10:11:10 -04:00
Mike Bayer 634d547425 - scoped_session emits a warning when configure() is
called if a Session is already present (checks only the
current thread) [ticket:1924]
2010-09-21 09:33:30 -04:00
Mike Bayer 4fbd16e045 - @classproperty (soon/now @mapperproperty) takes effect for
__mapper_args__, __table_args__, __tablename__ on
a base class that is not a mixin, as well as mixins.
[ticket:1922]
2010-09-20 12:00:14 -04:00
Mike Bayer c5c8cdf3b4 - as_scalar(), label() can be called on a selectable
which contains a Column that is not yet named.
[ticket:1862]
2010-09-18 13:34:04 -04:00
Mike Bayer 003149c504 - An informative error message is raised if a Column
which has not yet been assigned a name, i.e. as in
declarative, is used in a context where it is
exported to the columns collection of an enclosing
select() construct, or if any construct involving
that column is compiled before its name is
assigned.  [ticket:1862]
2010-09-18 13:18:44 -04:00
Mike Bayer f46c4028bc add oursql to has lastrowid 2010-09-18 12:35:25 -04:00
Mike Bayer 611fb77186 - use "key in dict" rather than KeyError if the usual case
is that the key is not present.
- don't need to uniquify Index schemes, just don't copy Indexes
that were known to be generated from the index=True flag
- user facing changes go in CHANGES
- Table.c allows string lookup
2010-09-18 11:40:25 -04:00
Chris Withers 065eb91c4d merge 2010-09-16 21:11:32 +01:00
Chris Withers 4bcb4c98f9 add warning about dodgy use of tometadata 2010-09-16 21:10:17 +01:00
Chris Withers 27cf184b50 tometadata now copies indexes as well 2010-09-16 20:58:15 +01:00
Chris Withers fd6c85cf7f make sure kwargs are copied by tometadata 2010-09-16 20:03:18 +01:00
Mike Bayer 90d4cdbac8 - Fixed a regression in 0.6.4 whereby the change that
allowed cursor errors to be raised consistently broke
the result.lastrowid accessor.   Test coverage has
been added for result.lastrowid.   Note that lastrowid
is only supported by Pysqlite and some MySQL drivers,
so isn't super-useful in the general case.
2010-09-16 11:29:01 -04:00
Mike Bayer 52735e75c5 - fix test_single test to use default dialect
- The exception raised by Session when it is used
subsequent to a subtransaction rollback (which is what
happens when a flush fails in autocommit=False mode) has
now been reworded (this is the "inactive due to a
rollback in a subtransaction" message). In particular,
if the rollback was due to an exception during flush(),
the message states this is the case, and reiterates the
string form of the original exception that occurred
during flush. If the session is closed due to explicit
usage of subtransactions (not very common), the message
just states this is the case.

- The exception raised by Mapper when repeated requests to
its initialization are made after initialization already
failed no longer assumes the "hasattr" case, since
there's other scenarios in which this message gets
emitted, and the message also does not compound onto
itself multiple times - you get the same message for
each attempt at usage. The misnomer "compiles" is being
traded out for "initialize".
2010-09-15 22:20:01 -04:00
Mike Bayer 6409a06df1 - Fixed a regression in 0.6.5 which occurred if you
passed an empty list to "include_properties" on
mapper() [ticket:1918]
2010-09-15 19:17:14 -04:00
Mike Bayer 2ab0687ece - add message to documentation stating that collection validators cannot
load the collection being validated. [ticket:1916]
2010-09-15 17:42:16 -04:00
Mike Bayer 03523970d9 - Fixed bug that would prevent "subqueryload" from
working correctly with single table inheritance
    for a relationship from a subclass - the "where
    type in (x, y, z)" only gets placed on the inside,
    instead of repeatedly.

  - When using from_self() with single table inheritance,
    the "where type in (x, y, z)" is placed on the outside
    of the query only, instead of repeatedly.   May make
    some more adjustments to this.
2010-09-13 22:55:54 -04:00
Mike Bayer f5d2bb60a8 - Fixed recursion bug which could occur when moving
an object from one reference to another, with
backrefs involved, where the initiating parent
was a subclass (with its own mapper) of the
previous parent.
2010-09-13 02:09:38 -04:00
Mike Bayer 18f6a06a51 more docs on this 2010-09-12 19:52:41 -04:00
Mike Bayer 423753efaa need this too 2010-09-12 19:25:19 -04:00
Mike Bayer fe250af8eb - lazy loads for relationship attributes now use
the current state, not the "committed" state,
of foreign and primary key attributes
when issuing SQL, if a flush is not in process.
Previously, only the database-committed state would
be used.  In particular, this would cause a many-to-one
get()-on-lazyload operation to fail, as autoflush
is not triggered on these loads when the attributes are
determined and the "committed" state may not be
available.  [ticket:1910]

- A new flag on relationship(), load_on_pending, allows
the lazy loader to fire off on pending objects without a
flush taking place, as well as a transient object that's
been manually "attached" to the session. Note that this
flag blocks attribute events from taking place when an
object is loaded, so backrefs aren't available until
after a flush. The flag is only intended for very
specific use cases.
2010-09-12 19:18:08 -04:00
Mike Bayer bad4493842 - Slight improvement to the behavior of "passive_updates=False"
when placed only on the many-to-one side of a
    relationship; documentation has been clarified
    that passive_updates=False should really be on the
    one-to-many side.

  - Placing passive_deletes=True on a many-to-one emits
    a warning, since you probably intended to put it on
    the one-to-many side.
2010-09-12 12:37:43 -04:00
Mike Bayer 9674b4bf17 - collection docs
- Added an assertion during flush which ensures
that no NULL-holding identity keys were generated
on "newly persistent" objects.
This can occur when user defined code inadvertently
triggers flushes on not-fully-loaded objects.
2010-09-09 19:21:23 -04:00
Mike Bayer a48ee1b397 - add doc pages for exceptions 2010-09-09 09:24:55 -04:00
Mike Bayer ce7768e313 doc edits 2010-09-08 23:06:40 -04:00
Mike Bayer a191ded054 edits 2010-09-08 15:43:24 -04:00
Mike Bayer 992dd2c055 - Applied patches from [ticket:1904] to get
basic Informix functionality up again.  We
rely upon end-user testing to ensure that
Informix is working to some degree.
2010-09-07 12:37:43 -04:00
Mike Bayer 177fdcb982 - Added a mutex to the identity map which mutexes
remove operations against iteration methods,
which now pre-buffer before returning an
iterable.   This because asyncrhonous gc
can remove items via the gc thread at any time.
[ticket:1891]
2010-09-07 12:16:29 -04:00
Mike Bayer 9bf88fa891 - pending deprecation in 0.7 for the execute/scalar on clauseelement 2010-09-07 11:57:19 -04:00
Mike Bayer d2bff71138 - Fixed FB bug whereby a column default would fail to
reflect if the "default" keyword were lower case.
2010-09-06 13:41:59 -04:00
Mike Bayer c25437301c unify query.with_parent, util.with_parent, fix docs some more 2010-09-06 12:24:28 -04:00
Mike Bayer 900fe9c9ac doc updates 2010-09-06 11:48:22 -04:00
Mike Bayer a9aa4c2178 merge doc fixes from tip 2010-09-06 10:56:19 -04:00
Mike Bayer ccde531935 - query.with_parent() now accepts transient objects
and will use the non-persistent values of their pk/fk
attributes in order to formulate the criterion.
Docs are also clarified as to the purpose of with_parent().
- fix for PG test executing an alias()
2010-09-06 10:55:53 -04:00
Mike Bayer 3a12b3540e fixes 2010-09-05 17:52:33 -04:00
Mike Bayer b1f3b61765 merge tip 2010-09-05 16:07:40 -04:00
Mike Bayer 914ae5bcd4 fixup 2010-09-05 16:06:39 -04:00
Mike Bayer 703ce7f179 - rewrote the "connections" section
- improved pool docs
- typos etc.
- ClauseElement.execute() and scalar() make no sense - these are depreacted.
The official home is Executable.
- alias() is not executable, allowing it is sloppy so this goes under
the deprecated umbrella
2010-09-05 14:44:58 -04:00
Mike Bayer 7217711f46 - mapper _get_col_to_prop private method used
by the versioning example is deprecated;
now use mapper.get_property_by_column() which
will remain the public method for this.
- turned TODO in the history example into an assertion
with a descriptive reason
2010-09-05 11:28:43 -04:00
Mike Bayer 1f65ac6679 roughly the finished product. 2010-09-04 21:02:35 -04:00
Mike Bayer b42cbed427 almost through. 2010-09-04 19:59:21 -04:00
Mike Bayer a315c5d431 continued... 2010-09-04 16:00:25 -04:00
Mike Bayer 4e24d6cb01 experiment with removing the API section and putting docstrings inline.
new outline section is provided with a new flow.
2010-09-04 13:25:13 -04:00
Mike Bayer 6e83926657 python 2.4 2010-09-03 15:55:09 -04:00
Jason Kirtland f0aaeb0290 Apply more memoization to Mapper attributes & subject to group expiry. 2010-09-03 12:05:24 -07:00
Mike Bayer fc46270f47 - AbstractType.__str__() produces the string version of the type with default dialect
- 79 chars
2010-09-03 14:35:22 -04:00
Mike Bayer 3d439e1801 - a large hill to climb. Added declarative examples to all the
"basic relationship" examples, cleaned up the examples and added
some more explicitness.  Also renamed "treenodes" to "nodes" and
added self-referential declarative example.
- Added info/examples on how to join tables directly when querying with
joined table inheritance.
-  Starting to talk about hybrids in the main mapper docs some more.
introducoed the idea that synonyms are on their way out.
- SQL expressions as mapped attributes also gets better verbiage,
alternative approaches to them, including hybrids.
- modernized the hybrid example.
- object_session() as a standalone function wasn't documented ?!
2010-08-30 20:10:03 -04:00
Mike Bayer 092fbb40eb - The include_properties and exclude_properties arguments
to mapper() now accept Column objects as members in
addition to strings.  This so that same-named Column
objects, such as those within a join(), can be
disambiguated.

- A warning is now emitted if a mapper is created against a
join or other single selectable that includes multiple
columns with the same name in its .c. collection,
and those columns aren't explictly named as part of
the same or separate attributes (or excluded).
In 0.7 this warning will be an exception.   Note that
this warning is not emitted when the combination occurs
as a result of inheritance, so that attributes
still allow being overridden naturally.
[ticket:1896].  In 0.7 this will be improved further.

- The primary_key argument to mapper() can now specify
a series of columns that are only a subset of
the calculated "primary key" columns of the mapped
selectable, without an error being raised.  This
helps for situations where a selectable's effective
primary key is simpler than the number of columns
in the selectable that are actually marked as
"primary_key", such as a join against two
tables on their primary key columns [ticket:1896].
2010-08-30 17:41:47 -04:00
Mike Bayer 53f93a3ba7 doc tweak 2010-08-29 18:13:44 -04:00
Mike Bayer 3fc7951674 - The Session class is now present in sqlalchemy.orm.*.
We're moving away from the usage of create_session(),
which has non-standard defaults, for those situations
where a one-step Session constructor is desired. Most
users should stick with sessionmaker() for general use,
however.
2010-08-29 18:13:18 -04:00
Mike Bayer 36fa24603f - Oracle reflection of indexes has been tuned so
that indexes which include some or all primary
key columns, but not the same set of columns
as that of the primary key, are reflected.
Indexes which contain the identical columns
as that of the primary key are skipped within
reflection, as the index in that case is assumed
to be the auto-generated primary key index.
Previously, any index with PK columns present
would be skipped.  Thanks to Kent Bower
for the patch.  [ticket:1867]

- Oracle now reflects the names of primary key
constraints - also thanks to Kent Bower.
[ticket:1868]
2010-08-29 17:06:05 -04:00