Commit Graph

9336 Commits

Author SHA1 Message Date
Mike Bayer c0af2ee6c9 - add logic to compiler such that if stack is empty, we just
stringify a _label_reference() as is.
- add .key to _label_reference(), so that when _make_proxy()
is called, we don't call str() on it anyway.
- add a test to exercise Query's behavior of adding all the order_by
expressions to the columns list of the select, assert that things
work out when we have a _label_reference there, that it gets sucked
into the columns list and spit out on the other side, it's referred
to appropriately, etc.   _label_reference() could theoretically
be resolved at the point we iterate _raw_columns() but
it's better to just let things work as they already do (except
nicer, since we get "tablename.colname" instead of just "somename"
 in the columns list) so that we aren't adding a ton of overhead
to _columns_plus_names in the common case.
2014-09-02 10:49:46 -04:00
Mike Bayer b621d23251 - reorganize 2014-09-01 20:31:00 -04:00
Mike Bayer 7c6a45c480 - The :func:~.expression.column and :func:~.expression.table
constructs are now importable from the "from sqlalchemy" namespace,
just like every other Core construct.
- The implicit conversion of strings to :func:`.text` constructs
when passed to most builder methods of :func:`.select` as
well as :class:`.Query` now emits a warning with just the
plain string sent.   The textual conversion still proceeds normally,
however.  The only method that accepts a string without a warning
are the "label reference" methods like order_by(), group_by();
these functions will now at compile time attempt to resolve a single
string argument to a column or label expression present in the
selectable; if none is located, the expression still renders, but
you get the warning again. The rationale here is that the implicit
conversion from string to text is more unexpected than not these days,
and it is better that the user send more direction to the Core / ORM
when passing a raw string as to what direction should be taken.
Core/ORM tutorials have been updated to go more in depth as to how text
is handled.
fixes #2992
2014-09-01 20:19:54 -04:00
Mike Bayer 382f82538b - more updates to text docs, literal_column, column etc. in prep
for ticket 2992.
2014-09-01 17:20:49 -04:00
Mike Bayer 62d81c2ebd - walk back these literal SQL lectures into something much more succinct.
the ORM one in particular was really long winded and I don't really care if people
use text() anyway, they'll figure it out ;)
2014-08-31 20:26:40 -04:00
Mike Bayer bdfe680708 - improve from_statement() doc 2014-08-31 18:05:31 -04:00
Mike Bayer d7131ffad3 - optional 'b' here for py3k 2014-08-31 18:02:24 -04:00
Mike Bayer 1972331528 - refine this a bit to better check for exception type 2014-08-31 18:00:49 -04:00
Mike Bayer e42ced2eca - these tests were squashing deprecation warnings all along... 2014-08-31 18:00:34 -04:00
Mike Bayer 3c60d3b1ca - A new style of warning can be emitted which will "filter" up to
N occurrences of a parameterized string.   This allows parameterized
warnings that can refer to their arguments to be delivered a fixed
number of times until allowing Python warning filters to squelch them,
and prevents memory from growing unbounded within Python's
warning registries.
fixes #3178
2014-08-31 15:22:00 -04:00
Mike Bayer 903b0a42e7 - updated callcounts 2014-08-31 15:21:42 -04:00
Mike Bayer 7e417665d2 - start encouraging the use of text() for injection of string-based SQL
rather than straight strings.  reference #2992
2014-08-31 11:45:20 -04:00
Mike Bayer f995a63d6c - alter the yield_per eager restriction such that joined many-to-one loads
are still OK, since these should be fine.
2014-08-30 15:45:50 -04:00
Mike Bayer 0bd074cc5a - continue moving things out that don't need to be there
- an existing state shouldn't need its load_options/load_path updated;
it should maintain those from its original Query source.  there's no
tests that check this behavior
2014-08-30 02:35:35 -04:00
Mike Bayer 51c7005dc5 - clean up zoomark a little and try to get new profiles written 2014-08-30 00:11:32 -04:00
Mike Bayer 04f0e11051 - do the polymorphic thing as a decorator so it's out of the way otherwise 2014-08-29 20:10:54 -04:00
Mike Bayer a52f84d4d8 - bump callcounts down 2014-08-29 19:16:29 -04:00
Mike Bayer ab5a1a7f4a - pull out populators back into separate functions, though still very inlined 2014-08-29 17:46:57 -04:00
Mike Bayer e695138cb4 - further move things vertically, at which point things are inlined enough
that I'd like to start de-inlining again in the hopes of making this readable.
2014-08-29 16:57:12 -04:00
Mike Bayer 41a3e1fd99 - need to use safe_discard() at least in _restore_snapshot(), let's use it
everywhere in Session since the optimized one only applies to loading
2014-08-29 16:32:08 -04:00
Mike Bayer 8155138e0a - use default dialect for compile test here 2014-08-29 16:29:46 -04:00
Mike Bayer 5686472f42 - defaultdict benchmarks faster than a namedtuple; OK
- inline the column-based expiration operations as well
2014-08-29 16:28:19 -04:00
Mike Bayer 9449c10276 - reorganize how create_row_processor() communicates up to
instances(), using a named tuple it can assign to directly.  this way
we never have to worry about that structure changing anymore, though
we are still having it append (key, fn) which is kind of awkward.
- inline _populators() into instance(), it's a little verbose but
saves an fn call
2014-08-29 15:07:11 -04:00
Mike Bayer b9046a163b - re-establish and test some behavior from previous versions, that
if a load() or refresh() event changes history (which...why...but anyway)
the state of the object is the same; currently it seems that history
gets reset but on a refresh, the object still goes into session.dirty
- simplify what we store in partials
2014-08-29 14:25:09 -04:00
Mike Bayer eb8a39c58c - The :class:.Query will raise an exception when :meth:.Query.yield_per
is used with mappings or options where eager loading, either
joined or subquery, would take place.  These loading strategies are
not currently compatible with yield_per, so by raising this error,
the method is safer to use - combine with sending False to
:meth:`.Query.enable_eagerloads` to disable the eager loaders.
2014-08-29 14:01:38 -04:00
Mike Bayer faf319fff5 - we've got 25% improvement so let's talk about it 2014-08-29 13:35:25 -04:00
Mike Bayer 3fb9aed2cc - add some more docs to yield_per 2014-08-29 13:35:03 -04:00
Mike Bayer 9d25eae8ee - use a faster discard when loading
- don't do a bool on identity map since it calls __len__
2014-08-29 13:11:52 -04:00
Mike Bayer a95b0a5b6e - inline the commit of partials too 2014-08-29 12:49:06 -04:00
Mike Bayer fbcb056d90 - Changed the approach by which the "single inheritance criterion"
is applied, when using :meth:`.Query.from_self`, or its common
user :meth:`.Query.count`.  The criteria to limit rows to those
with a certain type is now indicated on the inside subquery,
not the outside one, so that even if the "type" column is not
available in the columns clause, we can filter on it on the "inner"
query.
fixes #3177
2014-08-29 12:05:00 -04:00
Mike Bayer 08d2c863df - dropping callcounts 2014-08-29 11:22:54 -04:00
Mike Bayer d2a8d5b23c inlines galore 2014-08-29 10:59:13 -04:00
Mike Bayer c192e447f3 - major refactoring/inlining to loader.instances(), though not really
any speed improvements :(.   code is in a much better place to be run into
C, however
- The ``proc()`` callable passed to the ``create_row_processor()``
method of custom :class:`.Bundle` classes now accepts only a single
"row" argument.
- Deprecated event hooks removed:  ``populate_instance``,
``create_instance``, ``translate_row``, ``append_result``
- the getter() idea is somewhat restored; see ref #3175
2014-08-28 20:06:49 -04:00
Mike Bayer fa55225471 - Made a small adjustment to the mechanics of lazy loading,
such that it has less chance of interfering with a joinload() in the
very rare circumstance that an object points to itself; in this
scenario, the object refers to itself while loading its attributes
which can cause a mixup between loaders.   The use case of
"object points to itself" is not fully supported, but the fix also
removes some overhead so for now is part of testing.
fixes #3145
2014-08-28 17:57:48 -04:00
Mike Bayer 9f4caf97b0 - flake8 2014-08-28 17:42:41 -04:00
Mike Bayer becd78503f - this is small optimization, currently it's the best we can do
for #3175.  fixes #3175 (for now)
2014-08-28 12:41:50 -04:00
Mike Bayer 685a014c64 - A new implementation for :class:.KeyedTuple used by the
:class:`.Query` object offers dramatic speed improvements when
fetching large numbers of column-oriented rows.
fixes #3176
2014-08-28 12:25:21 -04:00
Mike Bayer 00862a29c6 - The behavior of :paramref:.joinedload.innerjoin as well as
:paramref:`.relationship.innerjoin` is now to use "nested"
inner joins, that is, right-nested, as the default behavior when an
inner join joined eager load is chained to an outer join eager load.
fixes #3008
2014-08-26 17:23:23 -04:00
Mike Bayer e346ee2c57 - hard-won pep8 formatting of one of the giants... 2014-08-26 16:36:56 -04:00
Mike Bayer f44a4b6437 - updates to migration / changelog for 1.0 2014-08-26 14:44:50 -04:00
Mike Bayer 8e84942aa6 - changelog for pr bitbucket:28 2014-08-25 19:14:47 -04:00
Mike Bayer 3531a92416 Merge branch 'mutable-dict-update' of https://bitbucket.org/goodscloud/sqlalchemy into pr27 2014-08-25 19:13:47 -04:00
Mike Bayer 4c1c9d5ed7 - changelog for pr bitbucket:27 2014-08-25 19:13:25 -04:00
Mike Bayer 8c8d6ee95d Merge branch 'mutable-dict-coerce-fix' of https://bitbucket.org/goodscloud/sqlalchemy into pr27 2014-08-25 19:10:43 -04:00
Mike Bayer a16ee423e4 - mention that FOUND_ROWS is hardcoded; fixes #3146 2014-08-25 17:15:16 -04:00
Mike Bayer be2351481f - The "resurrect" ORM event has been removed. This event hook had
no purpose since the old "mutable attribute" system was removed
in 0.8.
fixes #3171
2014-08-25 17:00:21 -04:00
Mike Bayer b1aa0edf81 Merge branch 'pr129'
Conflicts:
	doc/build/changelog/changelog_10.rst
2014-08-23 15:21:54 -04:00
Mike Bayer b490534657 - pep8 formatting for pg table opts feature, tests
- add support for PG INHERITS
- fix mis-named tests
- changelog
fixes #2051
2014-08-23 15:21:16 -04:00
Mike Bayer 575c4ee5c6 Merge remote-tracking branch 'origin/pr/131' 2014-08-21 17:38:23 -04:00
mike bayer b4af17b342 Merge pull request #130 from gthb/docfix-1
Fix doc typos and copy-paste error
2014-08-21 17:33:26 -04:00