Commit Graph

10240 Commits

Author SHA1 Message Date
Mike Bayer c52580dede - rework ColumnAdapter and ORMAdapter to only provide the features
we're now using; rework them fully so that their behavioral contract
is consistent regarding adapter.traverse() vs. adapter.columns[],
add a full suite of tests including advanced wrapping scenarios
previously only covered by test/orm/test_froms.py and
test/orm/inheritance/test_relationships.py
- identify several cases where label._order_by_label_clause would be
corrupted, e.g. due to adaption or annotation separately
- add full tests for #3148
2014-09-07 14:55:44 -04:00
Mike Bayer 7950270cf2 - enhance ClauseAdapter / ColumnAdapter to have new behaviors with labels.
The "anonymize label" logic is now generalized to ClauseAdapter, and takes
place when the anonymize_labels flag is sent, taking effect for all
.columns lookups as well as within traverse() calls against the label
directly.
- traverse() will also memoize what it gets in columns, so that
calling upon traverse() / .columns against the same Label will
produce the same anonymized label.  This is so that AliasedClass
produces the same anonymized label when it is accessed per-column
(e.g. SomeAlias.some_column) as well as when it is applied to a Query,
and within column loader strategies (e.g. query(SomeAlias)); the
former uses traverse() while the latter uses .columns
- AliasedClass now calls onto ColumnAdapter
- Query also makes sure to use that same ColumnAdapter from the AliasedClass
in all cases
- update the logic from 0.9 in #1068 to make use of the same
_label_resolve_dict we use for #2992, simplifying how that works
and adding support for new scenarios that were pretty broken
(see #3148, #3188)
2014-09-07 00:01:34 -04:00
Mike Bayer e80c7cc5c1 wip for #3148 2014-09-06 17:56:53 -04:00
Mike Bayer 4e285fd6ba - document all the varities of _label on the base ColumnElement
- replace out _columns_clause_label with a straight boolean flag to
reduce the proliferation of labels
2014-09-06 16:20:01 -04:00
Mike Bayer fa7c8f8811 - try to finish up the performance example for now 2014-09-06 13:01:21 -04:00
Mike Bayer 6844f8db74 - omit MySQL index flavor if its None 2014-09-05 17:02:33 -04:00
Mike Bayer 7b766591b0 - MySQL boolean symbols "true", "false" work again. 0.9's change
in 🎫`2682` disallowed the MySQL dialect from making use of the
"true" and "false" symbols in the context of "IS" / "IS NOT", but
MySQL supports this syntax even though it has no boolean type.
MySQL remains "non native boolean", but the :func:`.true`
and :func:`.false` symbols again produce the
keywords "true" and "false", so that an expression like
``column.is_(true())`` again works on MySQL.
fixes #3186
2014-09-05 16:44:42 -04:00
Mike Bayer d39daa43fe Merge branch 'master' into ticket_3100 2014-09-05 16:29:08 -04:00
Mike Bayer 583287259f - delete the file first here so this is deterministic 2014-09-05 16:28:32 -04:00
Mike Bayer 356d6659b1 - tiny refactors #1-#5 2014-09-05 16:28:20 -04:00
Rodrigo Menezes fd2faa9bc2 Added documentation. Changed my mind - added get_foreign_table_names() only to PGInspect and not in the Dialect. Added tests for PGInspect and removed a bunch of the old test scaffolding. 2014-09-05 13:54:48 -04:00
Rodrigo Menezes 619b0be0ce Added get_foreign_table_names to interface and put it in the test requirements. 2014-09-05 13:37:32 -04:00
Mike Bayer d2c05c36a5 - add a test that shows query caching. 2014-09-04 20:55:38 -04:00
Mike Bayer eb81531275 tweak 2014-09-03 20:30:52 -04:00
Mike Bayer cbef6a7d58 refine 2014-09-03 20:07:08 -04:00
Mike Bayer 84d4651f3d Merge branch 'master' into ticket_3100 2014-09-03 19:44:40 -04:00
Mike Bayer 2b10aa45a1 - ensure literal_binds works with LIMIT clause, FOR UPDATE 2014-09-03 19:42:38 -04:00
Mike Bayer 2c081f9a4a - large resultsets 2014-09-03 19:30:38 -04:00
Rodrigo Menezes fbd2d70a5c Fixing some pep8s and adding get_foreign_tables. 2014-09-03 16:38:43 -04:00
Mike Bayer 07d061a17b - wip 2014-09-03 14:49:26 -04:00
Mike Bayer 4399431b53 - The hostname-based connection format for SQL Server when using
pyodbc will no longer specify a default "driver name", and a warning
is emitted if this is missing.  The optimal driver name for SQL Server
changes frequently and is per-platform, so hostname based connections
need to specify this. DSN-based connections are preferred.
fixes #3182
2014-09-03 10:31:29 -04:00
Mike Bayer 9494ca00d4 - lets start exampling this stuff 2014-09-02 19:46:55 -04:00
Mike Bayer ccfd26d969 - add options to get back pk defaults for inserts.
times spent start getting barely different...
2014-09-02 19:23:09 -04:00
Mike Bayer 7e0c224162 Merge branch 'master' into ticket_3100 2014-09-02 15:05:32 -04:00
Mike Bayer 613d8ca0f8 - default dialect, plus test against the default dialect... 2014-09-02 15:04:12 -04:00
Mike Bayer ec840a6eea - An adjustment to table/index reflection such that if an index
reports a column that isn't found to be present in the table,
a warning is emitted and the column is skipped.  This can occur
for some special system column situations as has been observed
with Oracle. fixes #3180
2014-09-02 14:18:09 -04:00
Mike Bayer 9ee89dc886 default dialect 2014-09-02 13:39:16 -04:00
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