Commit Graph

10240 Commits

Author SHA1 Message Date
Mike Bayer 0e6579bc62 Merge remote-tracking branch 'origin/pr/150' 2015-01-26 16:49:43 -05:00
Kai Groner 30ce7e93f4 Partial index support with sqlite dialects.
From https://www.sqlite.org/partialindex.html
> Partial indexes have been supported in SQLite since version 3.8.0.

Reflection does not expose the predicate of partial indexes.  The
postgresql dialect does detect such indexes and issue a warning.  I
looked into matching this level of support, but the sqlite pragma
index_info does not expose the predicate.  Getting this data would
probably require parsing the CREATE INDEX statement from sqlite_master.
2015-01-26 14:50:24 -05:00
Kai Groner 4a42bd5a2c Test for partial index support in sqlite dialects. 2015-01-26 14:48:23 -05:00
Mike Bayer 7b102eeaee - remove the clever approach w/ dialect events, and remove the need
for a for-loop through an empty tuple.   we add one more local flag
to handle the logic without repetition of dialect.do_execute()
calls.
2015-01-25 18:22:00 -05:00
Mike Bayer a33c250da2 - remove context-specific post-crud logic from Connection and inline post-crud
logic to some degree in DefaultExecutionContext.  In particular
we are removing post_insert() which doesn't appear to be used
based on a survey of prominent third party dialects.  Callcounts
aren't added to existing execute profiling tests and inserts might be
a little better.
- simplify the execution_options join in DEC.  Callcounts don't
appear affected.
2015-01-25 17:53:41 -05:00
Mike Bayer c3d898e8d0 - Added new user-space accessors for viewing transaction isolation
levels; :meth:`.Connection.get_isolation_level`,
:attr:`.Connection.default_isolation_level`.
- enhance documentation inter-linkage between new accessors,
existing isolation_level parameters, as well as in
the dialect-level methods which should be fully covered
by Engine/Connection level APIs now.
2015-01-20 11:42:02 -05:00
Mike Bayer 4032aaf097 - enhance detail here regarding the difference between
Connection.connection and engine.raw_connection()
2015-01-20 11:36:14 -05:00
Mike Bayer 10dd5fe810 formatting 2015-01-20 11:03:02 -05:00
Mike Bayer 234a5b9723 - restore r611883ffb35ca6664649f6328ae8 with additional fixes and an additional test
that is much more specific to #1326
2015-01-19 18:31:10 -05:00
Mike Bayer 26a1d8e77c - reverse the last commit temporarily as it breaks all the polymorphic cases 2015-01-19 18:00:21 -05:00
Mike Bayer 611883ffb3 - The primary :class:.Mapper of a :class:.Query is now passed to the
:meth:`.Session.get_bind` method when calling upon
:meth:`.Query.count`, :meth:`.Query.update`, :meth:`.Query.delete`,
as well as queries against mapped columns,
:obj:`.column_property` objects, and SQL functions and expressions
derived from mapped columns.   This allows sessions that rely upon
either customized :meth:`.Session.get_bind` schemes or "bound" metadata
to work in all relevant cases.
fixes #3227 fixes #3242 fixes #1326
2015-01-19 17:55:23 -05:00
Mike Bayer dacfe7dec2 - tests 2015-01-19 17:37:14 -05:00
Mike Bayer 6135c03230 - further fixes and even better tests for this block 2015-01-19 11:47:28 -05:00
Mike Bayer 3f84a94080 - another adjustment 2015-01-19 08:49:44 -05:00
Mike Bayer 28d0b8d1d1 - fix another issue from rf49c367ef, add another test 2015-01-18 23:32:52 -05:00
Mike Bayer f5d4f2685f - rework assertsql system, fixes #3293 2015-01-18 20:57:26 -05:00
Mike Bayer f49c367ef7 - fix a regression from ref #3178, where dialects that don't actually support
sane multi rowcount (e.g. pyodbc) would fail on multirow update.  add
a test that mocks this breakage into plain dialects
2015-01-17 21:58:49 -05:00
Mike Bayer 469b6fabaf - add an exclusion here that helps with the case of 3rd party
test suite redefining an existing test in test_suite
2015-01-17 12:46:20 -05:00
Mike Bayer f3a892a3ef - Custom dialects that implement :class:.GenericTypeCompiler can
now be constructed such that the visit methods receive an indication
of the owning expression object, if any.  Any visit method that
accepts keyword arguments (e.g. ``**kw``) will in most cases
receive a keyword argument ``type_expression``, referring to the
expression object that the type is contained within.  For columns
in DDL, the dialect's compiler class may need to alter its
``get_column_specification()`` method to support this as well.
The ``UserDefinedType.get_col_spec()`` method will also receive
``type_expression`` if it provides ``**kw`` in its argument
signature.
fixes #3074
2015-01-16 20:03:33 -05:00
Mike Bayer 79fa69f1f3 - Fixed bug where Postgresql dialect would fail to render an
expression in an :class:`.Index` that did not correspond directly
to a table-bound column; typically when a :func:`.text` construct
was one of the expressions within the index; or could misinterpret the
list of expressions if one or more of them were such an expression.
fixes #3174
2015-01-16 18:03:45 -05:00
Mike Bayer 41307cd733 - add new section to ORM referring to runtime inspection API,
more links, attempt to fix #3290
2015-01-14 12:02:41 -05:00
Mike Bayer b63aae2c23 - The "wildcard" loader options, in particular the one set up by
the :func:`.orm.load_only` option to cover all attributes not
explicitly mentioned, now takes into account the superclasses
of a given entity, if that entity is mapped with inheritance mapping,
so that attribute names within the superclasses are also omitted
from the load.  Additionally, the polymorphic discriminator column
is unconditionally included in the list, just in the same way that
primary key columns are, so that even with load_only() set up,
polymorphic loading of subtypes continues to function correctly.
fixes #3287
2015-01-13 17:04:35 -05:00
Mike Bayer 268bb4d5f6 - refine the previous commit a bit 2015-01-13 15:17:09 -05:00
Mike Bayer 92cc232726 - The multi-values version of :meth:.Insert.values has been
repaired to work more usefully with tables that have Python-
side default values and/or functions, as well as server-side
defaults. The feature will now work with a dialect that uses
"positional" parameters; a Python callable will also be
invoked individually for each row just as is the case with an
"executemany" style invocation; a server- side default column
will no longer implicitly receive the value explicitly
specified for the first row, instead refusing to invoke
without an explicit value. fixes #3288
2015-01-13 14:33:33 -05:00
Mike Bayer dc55ff6f99 repair formatting 2015-01-12 13:27:34 -05:00
Mike Bayer 5f1d34c4c8 - changelog for pr 41 2015-01-12 13:24:11 -05:00
Dimitris Theodorou f4b7b02e31 Add native_enum flag to Enum's repr() result
Needed for alembic autogenerate rendering.
2015-01-12 02:40:50 +01:00
Mike Bayer b8a8cdd1ff - doc fixes 2015-01-06 11:45:17 -05:00
Mike Bayer 67778e2062 - add a close here 2015-01-06 11:34:52 -05:00
Mike Bayer 57f684b4b4 - Fixed bug where if an exception were thrown at the start of a
:class:`.Query` before it fetched results, particularly when
row processors can't be formed, the cursor would stay open with
results pending and not actually be closed.  This is typically only
an issue on an interpreter like Pypy where the cursor isn't
immediately GC'ed, and can in some circumstances lead to transactions/
locks being open longer than is desirable.
fixes #3285
2015-01-05 21:38:19 -05:00
Mike Bayer 145d015151 fix verbiage 2015-01-05 19:07:33 -05:00
Mike Bayer 1104dcaa67 - add MemoizedSlots, a generalized solution to using __getattr__
for memoization on a class that uses slots.
- apply many more __slots__.  mem use for nova now at 46% savings
2015-01-05 19:02:08 -05:00
Mike Bayer 41ae0270d9 - make a new page that introduces mapping a little better for the
"mapping" section, contrasts declarative and classical some more
2015-01-05 14:20:03 -05:00
Mike Bayer 8257b3a017 - more callcounts
- add the platform key to the error output
2015-01-05 12:21:14 -05:00
Mike Bayer a324164933 - this is passing, no idea why 2015-01-04 21:05:53 -05:00
Mike Bayer 2a28dd9369 - callcounts
- this needs to be serializable and isn't high volume so just whack the slots
2015-01-04 21:01:27 -05:00
Mike Bayer 2f6ec41dc9 - fix test for new events 2015-01-04 19:43:48 -05:00
Mike Bayer 18d3dc7163 - Structural memory use has been improved via much more significant use
of ``__slots__`` for many internal objects.  This optimization is
particularly geared towards the base memory size of large applications
that have lots of tables and columns, and greatly reduces memory
size for a variety of high-volume objects including event listening
internals, comparator objects and parts of the ORM attribute and
loader strategy system.
2015-01-04 19:28:29 -05:00
Mike Bayer b3bf7915b5 - scale back _Dispatch and _JoinedDispatcher to use a __getitem__ scheme
to start up listener collections; this pulls the overhead off of construction
and makes performance much like the descriptor version, while still allowing
slots.   Fix up some profiles.
2015-01-04 19:05:31 -05:00
Mike Bayer 46a35b7647 - clean up default comparator which doesn't need to be a class,
get PG stuff working
2015-01-04 18:45:30 -05:00
Mike Bayer 27816e8f61 - strategies + declarative 2015-01-04 18:30:25 -05:00
Mike Bayer cf27232563 - wip - start factoring events so that we aren't using descriptors for dispatch,
allowing us to move to __slots__
2015-01-04 18:06:02 -05:00
Mike Bayer 315db703a6 - start trying to move things into __slots__. This seems to reduce the
size of the many per-column objects we're hitting, but somehow the overall memory is
hardly being reduced at all in initial testing
2015-01-04 01:53:42 -05:00
Mike Bayer b1928d7209 - use a different bitwise approach here that doesn't require iterating
through all possible set values
2015-01-03 23:22:07 -05:00
Mike Bayer 93742b3d5c - The :class:.mysql.SET type has been overhauled to no longer
assume that the empty string, or a set with a single empty string
value, is in fact a set with a single empty string; instead, this
is by default treated as the empty set.  In order to handle persistence
of a :class:`.mysql.SET` that actually wants to include the blank
value ``''`` as a legitimate value, a new bitwise operational mode
is added which is enabled by the
:paramref:`.mysql.SET.retrieve_as_bitwise` flag, which will persist
and retrieve values unambiguously using their bitflag positioning.
Storage and retrieval of unicode values for driver configurations
that aren't converting unicode natively is also repaired.
fixes #3283
2015-01-03 20:43:45 -05:00
Mike Bayer 01a22a673e - clean up SET tests 2015-01-03 18:49:14 -05:00
Mike Bayer bb40221a28 - tighten the inspection in _ColumnEntity to reduce unnecessary
isinstance() calls, express intent more clearly
2015-01-03 12:10:17 -05:00
Tony Locke 17e03a0ea8 Changed pg8000 dialect to cope with native JSON
For versions > 1.10.1 pg8000 returns de-serialized JSON objects rather
than a string. SQL parameters are still strings though.
2015-01-03 16:59:17 +00:00
Mike Bayer 378ad79713 - put this back now that we found the source of this 2015-01-02 16:43:11 -05:00
Mike Bayer 3ab50ec011 - test failures:
- test_schema_2 is only on PG and doesn't need a drop all, omit this for now
- py3k has exception.args[0], not message
2015-01-02 15:23:24 -05:00