Mike Bayer [Mon, 13 Dec 2010 05:15:32 +0000 (00:15 -0500)]
- why type.dialect_impl(dialect).bind_processor(dialect), caching just the impl?
just call type._cached_bind_processor(dialect), cache the impl *and* the processor function.
same for result sets.
- use plain dict + update for defaultexecutioncontext.execution_options
Mike Bayer [Sun, 12 Dec 2010 06:35:37 +0000 (01:35 -0500)]
- refactor query._get() into two methods - a static one that does
just the identity map lookup + expired check, the other
which does the load unconditionally. All the refresh/deferred load
calls use the unconditional load method, query.get() and
LoadLazyAttribute call the identity check by itself first. m2o
lazyloads for object already in the identity map callcounts are
now cut in half, since no Query object is created.
Mike Bayer [Sat, 11 Dec 2010 22:44:46 +0000 (17:44 -0500)]
- support for cdecimal
- add --with-cdecimal flag to tests, monkeypatches cdecimal in
- fix mssql/pyodbc.py to not use private '_int' accessor in decimal conversion
routines
- pyodbc version 2.1.8 is needed for cdecimal in any case as
previous versions also called '_int', 2.1.8 adds the same string
logic as our own dialect, so that logic is skipped for modern
pyodbc version
- make the imports for "Decimal" consistent across the whole lib. not sure
yet how we should be importing "Decimal" or what the best way forward
is that would allow a clean user-invoked swap of cdecimal; for now,
added docs suggesting a global monkeypatch - the two decimal libs
are not compatible with each other so any chance of mixing produces
serious issues. adding adapters to DBAPIs tedious and adds in-python
overhead. suggestions welcome on how we should be doing
Decimal/cdecimal.
Mike Bayer [Sat, 11 Dec 2010 08:05:03 +0000 (03:05 -0500)]
- clean up the batch insert thing
- add a test for batch inserts
- don't need elaborate _inserted_primary_key thing
- take some cruft out of ExecutionContext, ResultProxy,
EC members can be non-underscored, have mapper just call the
EC members for now.
- simplify "connection_callable", no need for a "flush_opts"
dictionary since this point of expansion is not needed
Mike Bayer [Wed, 8 Dec 2010 18:46:29 +0000 (13:46 -0500)]
- Threadlocal engine methods rollback(), commit(),
prepare() won't raise if no transaction is in progress;
this was a regression introduced in 0.6. [ticket:1998]
Mike Bayer [Mon, 6 Dec 2010 23:45:19 +0000 (18:45 -0500)]
- hardwire the huge LIMIT number on MySQL. this might fix the OurSQL py3k
bug we're having, though I'm not able to get a good run of OurSQL
on OSX right now either Python 2 or 3.
Mike Bayer [Sun, 5 Dec 2010 06:41:37 +0000 (01:41 -0500)]
- inline the various construction methods of DefaultExecutionContext. This
makes it sort of easier to read, sort of harder, depending on where you look.
Cuts down two or three method calls on execute.
Mike Bayer [Sun, 5 Dec 2010 05:46:11 +0000 (00:46 -0500)]
- ResultProxy and friends always reference the DBAPI connection at the same time
as the cursor. There is no reason for CursorFairy - the only use case would be,
end-user is using the pool or pool.manage with DBAPI connections, uses a cursor,
deferences the owning connection and continues using cursor. This is an almost
nonexistent use case and isn't correct usage at a DBAPI level. Take out CursorFairy.
- move the "check for a dot in the colname" logic out to the sqlite dialect.
Mike Bayer [Mon, 29 Nov 2010 23:38:44 +0000 (18:38 -0500)]
- use class name by itself in flush warnings to prevent overflow of warnings registry
- test suite swaps out warnings.warn with warnings.warn_explicit, to solve warnings registry issue
- explicitly disallow functions from inside test.bootstrap, test.lib being interpreted as tests
Mike Bayer [Sun, 28 Nov 2010 21:27:44 +0000 (16:27 -0500)]
after some usage, its clear that [ticket:1974] should not be implemented. backrefs
add to collections so its expected that collection membership would mirror in session
membership.
Backed out changeset e836366c843cd64a0df569582534868e3fb00f3b
Mike Bayer [Sun, 28 Nov 2010 19:19:44 +0000 (14:19 -0500)]
- 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
Mike Bayer [Sun, 28 Nov 2010 18:45:51 +0000 (13:45 -0500)]
- a column with a "mutable" type mapped as "deferred" will not
emit a load for the "old" value upon a set event,
unless the "active_history" flag is set to True. [ticket:1976]
Mike Bayer [Sun, 28 Nov 2010 18:40:56 +0000 (13:40 -0500)]
- Pooling methods now underscored or removed:
Pool.create_connection() -> Pool._create_connection()
Pool.do_get() -> Pool._do_get()
Pool.do_return_conn() -> Pool._do_return_conn()
Pool.do_return_invalid() -> removed, was not used
Pool.return_conn() -> Pool._return_conn()
Pool.get() -> Pool._get(), public API is Pool.connect()
SingletonThreadPool.cleanup() -> _cleanup()
SingletonThreadPool.dispose_local() -> removed, use conn.invalidate()
Mike Bayer [Sun, 28 Nov 2010 17:14:51 +0000 (12:14 -0500)]
- the names used in the NamedTuple returned by Query.__iter__()
will be transferred from the individual Query objects that compose
a union() or similar, as opposed to returning the "table_colname"
alias generated when subqueries are generated. [ticket:1942]
Mike Bayer [Sun, 28 Nov 2010 17:00:01 +0000 (12:00 -0500)]
- NullPool is now used by default for SQLite file-
based databases. :memory: databases will continue
to select SingletonThreadPool by default.
[ticket:1921]
Mike Bayer [Sun, 28 Nov 2010 16:52:24 +0000 (11:52 -0500)]
- post_process_text() is called for DDL() constructs, in particular allowing
'%' with only one level of escaping. Note this is backwards-incompatible
with previously triple-escaped sections. [ticket:1897]
Mike Bayer [Sun, 28 Nov 2010 16:10:41 +0000 (11:10 -0500)]
- 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.
Gaëtan de Menten [Sat, 27 Nov 2010 21:27:42 +0000 (22:27 +0100)]
fixed a small potential memory leak in UnicodeResultProcessor (for some weird
reason, it didn't actually leak in my tests) by providing a dealloc method to
the type, and added a test to ensure it stays that way. Closes #1981.
Mike Bayer [Thu, 25 Nov 2010 17:20:13 +0000 (12:20 -0500)]
- Fixed operator precedence rules for multiple
chains of a single non-associative operator.
I.e. "x - (y - z)" will compile as "x - (y - z)"
and not "x - y - z". Also works with labels,
i.e. "x - (y - z).label('foo')"
[ticket:1984]
- Single element tuple expressions inside an IN clause
parenthesize correctly, also from [ticket:1984],
added tests for PG
- re-fix again importlater, [ticket:1983]
Mike Bayer [Wed, 24 Nov 2010 17:21:59 +0000 (12:21 -0500)]
- SqlSoup overhaul
- Added "map_to()" method to SqlSoup, which is a "master"
method which accepts explicit arguments for each aspect of
the selectable and mapping, including a base class per
mapping. [ticket:1975]
- Mapped selectables used with the map(), with_labels(),
join() methods no longer put the given argument into the
internal "cache" dictionary. Particularly since the
join() and select() objects are created in the method
itself this was pretty much a pure memory leaking behavior.
Mike Bayer [Sat, 20 Nov 2010 22:57:30 +0000 (17:57 -0500)]
- fixes for PG, mysql, twophase
- added "pool_events" arg to create_engine(), "events" to pool, allowing
establishment of listeners which fire before those of the dialect
Mike Bayer [Sat, 20 Nov 2010 21:28:39 +0000 (16:28 -0500)]
- logging has been overhauled such that engines no longer need to encode the
"hex id" string in their logging name in order to maintain separate loggers
per engine. thanks to Vinay Sajip for assistance. merge of [ticket:1926]
Mike Bayer [Sat, 20 Nov 2010 21:25:12 +0000 (16:25 -0500)]
- the column assigned to polymorphic_on now behaves like any other
mapped attribute, in that it can be assigned to, mapped to multiple
columns. It is also populated immediately upon object construction
with its class-based value, so the attribute can be read before
any flush occurs. [ticket:1895]
Mike Bayer [Sat, 20 Nov 2010 20:43:12 +0000 (15:43 -0500)]
- bindparam() gets a new option "callable", which is a lambda or def
evaluated at execution time to determine the value. This replaces
the implicit recognition of callables sent as the primary value
of bindparam(), which was an undocumented behavior used by the ORM.
The argument is separated now so that values can be passed to
bindparams that are also callables without ambiguity, such
as user defined objects that include a __call__() method.
[ticket:1950]