Commit Graph

4067 Commits

Author SHA1 Message Date
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
Mike Bayer 87fd1e3260 docstring for query.correlate, [ticket:1889] 2010-08-29 15:30:43 -04:00
Mike Bayer 7c63679bdb - Added ROWID type to the Oracle dialect, for those
cases where an explicit CAST might be needed.
[ticket:1879]
2010-08-29 15:16:02 -04:00
Mike Bayer 5589df6b56 - put a link to the wiki table config example 2010-08-27 12:57:18 -04:00
Mike Bayer af9fd453c0 - An object that's been deleted now gets a flag
'deleted', which prohibits the object from
being re-add()ed to the session, as previously
the object would live in the identity map
silently until its attributes were accessed.
The make_transient() function now resets this
flag along with the "key" flag.

- make_transient() can be safely called on an
already transient instance.
2010-08-26 11:32:50 -04:00
Mike Bayer 7d3a916fc3 - replaced all self.__connection.is_valid with
"safe" self._connection_is_valid.
- Fixed bug in Connection whereby if a "disconnect"
event occurred in the "initialize" phase of the
first connection pool connect, an AttributeError
would be raised when the Connection would attempt
to invalidate the DBAPI connection.  [ticket:1894]
- Connection.invalidate() can be called more than
once and subsequent calls do nothing.
2010-08-26 01:33:51 -04:00
Mike Bayer abbb080d45 some doc updates 2010-08-24 01:01:04 -04:00
Mike Bayer ac9eb5c9c3 - Similarly, for relationship(), foreign_keys,
remote_side, order_by - all column-based
expressions are enforced - lists of strings
are explicitly disallowed since this is a
very common error
2010-08-21 19:38:28 -04:00
Mike Bayer 61562e5843 - object_session() raises the proper
UnmappedInstanceError when presented with an
unmapped instance.  [ticket:1881]
2010-08-18 10:54:40 -04:00
Mike Bayer ff1d504fc4 - 79 chars for expression
- fix typo in test
2010-08-14 20:51:37 -04:00
Mike Bayer 8fc50cd3a4 - Another pass through the series of error messages
emitted when relationship() is configured with
ambiguous arguments.   The "foreign_keys"
setting is no longer mentioned, as it is almost
never needed and it is preferable users set up
correct ForeignKey metadata, which is now the
recommendation.  If 'foreign_keys'
is used and is incorrect, the message suggests
the attribute is probably unnecessary.  Docs
for the attribute are beefed up.  This
because all confused relationship() users on the
ML appear to be attempting to use foreign_keys
due to the message, which only confuses them
further since Table metadata is much clearer.

- If the "secondary" table has no ForeignKey metadata
and no foreign_keys is set, even though the
user is passing screwed up information, it is assumed
that primary/secondaryjoin expressions should
consider only and all cols in "secondary" to be
foreign.  It's not possible with "secondary" for
the foreign keys to be elsewhere in any case.
A warning is now emitted instead of an error,
and the mapping succeeds. [ticket:1877]

- fixed incorrect "Alternate Collection Mappings" reference
in the docs, not sure if someone wants to reference
"Rows that Point to Themselves" function
- "Collection Mapping" is "Advanced Collection Mapping", this
section is troublesome since nobody really needs it but it
is public API
2010-08-14 14:52:18 -04:00
Mike Bayer 252ab17c7d - Added basic math expression coercion for
Numeric->Integer,
so that resulting type is Numeric regardless
of the direction of the expression.
2010-08-13 14:25:58 -04:00