Mike Bayer [Sat, 9 Feb 2008 01:48:19 +0000 (01:48 +0000)]
- lazy loader can now handle a join condition where the "bound"
column (i.e. the one that gets the parent id sent as a bind
parameter) appears more than once in the join condition.
Specifically this allows the common task of a relation()
which contains a parent-correlated subquery, such as "select
only the most recent child item". [ticket:946]
- col_is_part_of_mappings made more strict, seems to be OK
with tests
- memusage will dump out the size list in an assertion fail
Mike Bayer [Sat, 9 Feb 2008 01:24:01 +0000 (01:24 +0000)]
heisenbug in aisle 3
(when db.dispose is called in unitofwork test with sqlite, the first test that runs in memusage grows by two gc'ed objects on every iteration; then the problem vanishes. doesnt matter what test runs in memusage. doing a dispose() in memusage solves the problem also. screwing wiht the mechanics of engine.dispose() only fix it when both the pool.dispose() *and* the pool.ressurect() are disabled. its just a subtle python/pysqlite bug afaict)
Mike Bayer [Fri, 8 Feb 2008 22:57:45 +0000 (22:57 +0000)]
- added generative where(<criterion>) method to delete()
and update() constructs which return a new object with
criterion joined to existing criterion via AND, just
like select().where().
- compile assertions use assertEquals()
Jason Kirtland [Tue, 5 Feb 2008 23:31:14 +0000 (23:31 +0000)]
- Enabled schema support on SQLite, added the temporary table namespace to table name reflection
- TODO: add sqlite to the standard alternate schema tests. a little tricky, because unlike CREATE SCHEMA, an ATTACH DATABASE won't survive a pool dispose...
Jason Kirtland [Tue, 5 Feb 2008 17:26:35 +0000 (17:26 +0000)]
- Autodetect mysql's ANSI_QUOTES mode, sometimes. [ticket:845]
The dialect needs a hook run on first pool connect to detect this most of
the time, and a refactor with Dialect-per-Connection to get it right all of
the time. (It's a connection-session scoped setting with dialect-modifying
behavior)
Jason Kirtland [Tue, 5 Feb 2008 05:46:33 +0000 (05:46 +0000)]
- Added free-form `DDL` statements, can be executed standalone or tied to the DDL create/drop lifecycle of Tables and MetaData. [ticket:903]
- Added DDL event hooks, triggers callables before and after create / drop.
Mike Bayer [Mon, 4 Feb 2008 21:47:42 +0000 (21:47 +0000)]
- add dummy column to appease older SQLite verisons in unicode.py
- add test "escape_literal_column" comiler method to start addressing literal '%' character
Mike Bayer [Mon, 4 Feb 2008 20:35:25 +0000 (20:35 +0000)]
forcibly clean out _sessions, _mapper_registry at test start to eliminate leftovers from other unit tests (from other test scripts) still stored in memory
Mike Bayer [Fri, 1 Feb 2008 01:16:18 +0000 (01:16 +0000)]
- some consolidation of tests in select.py, moved
other tests to more specific modules
- added "now()" as a generic function; on SQLite and
Oracle compiles as "CURRENT_TIMESTAMP"; "now()"
on all others [ticket:943]
Mike Bayer [Thu, 31 Jan 2008 17:48:22 +0000 (17:48 +0000)]
- added "autocommit=True" kwarg to select() and text(),
as well as generative autocommit() method on select();
for statements which modify the database through some
user-defined means other than the usual INSERT/UPDATE/
DELETE etc., this flag will enable "autocommit" behavior
during execution if no transaction is in progress
[ticket:915]
Mike Bayer [Thu, 31 Jan 2008 03:57:20 +0000 (03:57 +0000)]
- the startswith(), endswith(), and contains() operators
now concatenate the wildcard operator with the given
operand in SQL, i.e. "'%' || <bindparam>" in all cases,
accept text('something') operands properly [ticket:962]
- cast() accepts text('something') and other non-literal
operands properly [ticket:962]
Mike Bayer [Wed, 30 Jan 2008 21:08:11 +0000 (21:08 +0000)]
- Oracle and others properly encode SQL used for defaults
like sequences, etc., even if no unicode idents are used
since identifier preparer may return a cached unicode
identifier.
Mike Bayer [Wed, 30 Jan 2008 17:35:20 +0000 (17:35 +0000)]
- next release will be 0.4.3
- fixed merge() collection-doubling bug when merging
transient entities with backref'ed collections.
[ticket:961]
- merge(dont_load=True) does not accept transient
entities, this is in continuation with the fact that
merge(dont_load=True) does not accept any "dirty"
objects either.
Mike Bayer [Mon, 28 Jan 2008 23:15:40 +0000 (23:15 +0000)]
- "Passive defaults" and other "inline" defaults can now
be loaded during a flush() call if needed; in particular,
this allows constructing relations() where a foreign key
column references a server-side-generated, non-primary-key
column. [ticket:954]
Mike Bayer [Sun, 27 Jan 2008 02:21:23 +0000 (02:21 +0000)]
- Fixed bug in polymorphic inheritance where incorrect
exception is raised when base polymorphic_on
column does not correspond to any columns within
the local selectable of an inheriting mapper more
than one level deep
Mike Bayer [Wed, 23 Jan 2008 19:20:49 +0000 (19:20 +0000)]
- query.join() can also accept tuples of attribute
name/some selectable as arguments. This allows
construction of joins *from* subclasses of a
polymorphic relation, i.e.:
Jason Kirtland [Mon, 21 Jan 2008 23:19:39 +0000 (23:19 +0000)]
- 2.3 fixup, part two: 100% passing for sqlite
- added 2.4-style binops to util.Set on 2.3
- OrderedSets pickle on 2.3
- more lib/sqlalchemy set vs Set corrections
- fixed InstrumentedSet.discard for 2.3
- set, sorted compatibility for test suite
- added testing.fails_if decorator
Ants Aasma [Sun, 20 Jan 2008 03:22:00 +0000 (03:22 +0000)]
- parent transactions weren't started on the connection when adding a connection to a nested session transaction.
- session.transaction now always refers to the innermost active transaction, even when commit/rollback are called directly on the session transaction object.
- when preparing a two-phase transaction fails on one connection all the connections are rolled back.
- two phase transactions can now be prepared.
- session.close() didn't close all transactions when nested transactions were used.
- rollback() previously erroneously set the current transaction directly to the parent of the transaction that could be rolled back to.
- autoflush for commit() wasn't flushing for simple subtransactions.
Jason Kirtland [Sat, 19 Jan 2008 23:37:11 +0000 (23:37 +0000)]
- Restored 2.3 compat. in lib/sqlalchemy
- Part one of test suite fixes to run on 2.3
Lots of failures still around sets; sets.Set differs from __builtin__.set
particularly in the binops. We depend on set extensively now and may need to
provide a corrected sets.Set subclass on 2.3.
Jason Kirtland [Sat, 19 Jan 2008 23:11:47 +0000 (23:11 +0000)]
- Added source transformation framework for non-2.4 parser implementations
- test/clone.py can create and update (transformed) copies of the test suite
- Added Python 2.4 decorator -> 2.3 source transform
Mike Bayer [Sat, 19 Jan 2008 20:11:29 +0000 (20:11 +0000)]
- Oracle assembles the correct columns in the result set
column mapping when generating a LIMIT/OFFSET subquery,
allows columns to map properly to result sets even
if long-name truncation kicks in [ticket:941]
Mike Bayer [Sat, 19 Jan 2008 18:36:52 +0000 (18:36 +0000)]
- some expression fixup:
- the '.c.' attribute on a selectable now gets an
entry for every column expression in its columns
clause; previously, "unnamed" columns like functions
and CASE statements weren't getting put there. Now
they will, using their full string representation
if no 'name' is available.
- The anonymous 'label' generated for otherwise
unlabeled functions and expressions now propagates
outwards at compile time for expressions like
select([select([func.foo()])])
- a CompositeSelect, i.e. any union(), union_all(),
intersect(), etc. now asserts that each selectable
contains the same number of columns. This conforms
to the corresponding SQL requirement.
- building on the above ideas, CompositeSelects
now build up their ".c." collection based on
the names present in the first selectable only;
corresponding_column() now works fully for all
embedded selectables.
Mike Bayer [Wed, 16 Jan 2008 22:06:15 +0000 (22:06 +0000)]
- dynamic relations, when referenced, create a strong
reference to the parent object so that the query
still has a parent to call against even if the
parent is only created (and otherwise dereferenced)
within the scope of a single expression [ticket:938]
Mike Bayer [Tue, 15 Jan 2008 17:59:27 +0000 (17:59 +0000)]
finally, a really straightforward reduce() method which reduces cols
to the minimal set for every test case I can come up with, and
now replaces all the cruft in Mapper._compile_pks() as well as
Join.__init_primary_key(). mappers can now handle aliased selects
and figure out the correct PKs pretty well [ticket:933]
Mike Bayer [Mon, 14 Jan 2008 04:20:26 +0000 (04:20 +0000)]
- query.join() can now accept class-mapped attributes
as arguments, which can be used in place or in any
combination with strings. In particular this allows
construction of joins to subclasses on a polymorphic
relation, i.e.
query(Company).join(['employees', Engineer.name]),
etc.
Mike Bayer [Mon, 14 Jan 2008 02:45:30 +0000 (02:45 +0000)]
- applying some refined versions of the ideas in the smarter_polymorphic
branch
- slowly moving Query towards a central "aliasing" paradigm which merges
the aliasing of polymorphic mappers to aliasing against arbitrary select_from(),
to the eventual goal of polymorphic mappers which can also eagerload other
relations
- supports many more join() scenarios involving polymorphic mappers in
most configurations
- PropertyAliasedClauses doesn't need "path", EagerLoader doesn't need to
guess about "towrap"
Mike Bayer [Sun, 13 Jan 2008 19:04:55 +0000 (19:04 +0000)]
- _get_equivalents() converted into a lazy-initializing property; Query was calling it
for polymorphic loads which is really expensive
- surrogate_mapper adapts the given order_by, so that order_by can be against the mapped
table and is usable for sub-mappers as well. Query properly calls select_mapper.order_by.
Jason Kirtland [Sat, 12 Jan 2008 22:03:42 +0000 (22:03 +0000)]
- testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
Jason Kirtland [Fri, 11 Jan 2008 01:28:43 +0000 (01:28 +0000)]
- Warnings are now issued as SAWarning instead of RuntimeWarning; util.warn() wraps this up.
- SADeprecationWarning has moved to exceptions. An alias remains in logging until 0.5.
Mike Bayer [Thu, 10 Jan 2008 22:32:51 +0000 (22:32 +0000)]
- added a mapper() flag "eager_defaults"; when set to
True, defaults that are generated during an INSERT
or UPDATE operation are post-fetched immediately,
instead of being deferred until later. This mimics
the old 0.3 behavior.