summaryrefslogtreecommitdiff
path: root/test/sql/test_text.py
Commit message (Collapse)AuthorAgeFilesLines
* Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-251-1/+18
| | | | | | | | | | | | | | Fixed bug in new percent-sign support (e.g. :ticket:`3740`) where a bound parameter rendered with literal_binds would fail to escape percent-signs for relevant dialects. In addition, ensured new table / column comment support feature also fully makes use of literal-rendered parameters so that this percent sign support takes place with table / column comment DDL as well, allowing percent sign support for the mysql / psycopg2 backends that require escaping of percent signs. Change-Id: Ia4136a300933e9bc6a01a7b9afd5c7b9a3fee4e3 Fixes: #4054 Fixes: #4052
* Double percent signs based on paramstyle, not dialectMike Bayer2017-04-051-0/+13
| | | | | | | | | | | | This patch moves the "doubling" of percent signs into the base compiler and makes it completely a product of whether or not the paramstyle is format/pyformat or not. Without this paramstyle, percent signs are not doubled across text(), literal_column(), and column(). Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197 Fixes: #3740
* Support python3.6Mike Bayer2017-01-131-6/+8
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* - Fixed bug in :func:`.expression.text` construct where a double-colonMike Bayer2016-02-091-0/+11
| | | | | | expression would not escape properly, e.g. ``some\:\:expr``, as is most commonly required when rendering Postgresql-style CAST expressions. fixes #3644
* Merge remote-tracking branch 'origin/pr/163' into pr163Mike Bayer2015-04-121-1/+0
|\
| * PEP8 cleanup in /test/sqlEric Streeper2015-03-181-1/+0
| |
* | - Fixed bug in new "label resolution" feature of :ticket:`2992` whereMike Bayer2015-03-231-0/+9
| | | | | | | | | | | | | | | | a label that was anonymous, then labeled again with a name, would fail to be locatable via a textual label. This situation occurs naturally when a mapped :func:`.column_property` is given an explicit label in a query. fixes #3340
* | - Fixed bug in new "label resolution" feature of :ticket:`2992` whereMike Bayer2015-03-211-0/+14
|/ | | | | | | | the string label placed in the order_by() or group_by() of a statement would place higher priority on the name as found inside the FROM clause instead of a more locally available name inside the columns clause. fixes #3335
* fooMike Bayer2015-03-081-4/+4
|
* - expect_warnings was not expecting and neither was assert_warningsMike Bayer2015-02-191-4/+4
| | | | asserting.
* - enhance ClauseAdapter / ColumnAdapter to have new behaviors with labels.Mike Bayer2014-09-071-5/+39
| | | | | | | | | | | | | | | | | | | | | 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)
* wip for #3148Mike Bayer2014-09-061-1/+27
|
* - add logic to compiler such that if stack is empty, we justMike Bayer2014-09-021-0/+5
| | | | | | | | | | | | | | | | 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.
* - The :func:`~.expression.column` and :func:`~.expression.table`Mike Bayer2014-09-011-25/+229
| | | | | | | | | | | | | | | | | | | | | 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
* - update the flake8 rules againMike Bayer2014-07-181-86/+106
| | | | - apply autopep8 + manual fixes to most of test/sql/
* Fix many typos throughout the codebasepr/85Alex Gaynor2014-04-261-4/+4
| | | | Found using: https://github.com/intgr/topy
* - Fixed issue in new :meth:`.TextClause.columns` method where the orderingMike Bayer2014-02-261-0/+14
| | | | | | of columns given positionally would not be preserved. This could have potential impact in positional situations such as applying the resulting :class:`.TextAsFrom` object to a union.
* - for TextAsFrom, put the "inner" columns in the result map directly.Mike Bayer2014-02-101-5/+72
| | | | | | | Have also considered linking column.label() to the "column" itself being in the result map but this reveals some naming collision problems (that also seem to be very poorly tested...). This should be as far as we want to go right now with [ticket:2932].
* - implement "literal binds" for the text() clause, [ticket:2882]Mike Bayer2013-12-111-0/+11
|
* - add support for bindparam() called from AsFromTextMike Bayer2013-11-291-0/+12
| | | | | - get PG dialect to work around "no nonexistent binds" rule for now, though we might want to reconsider this behavior
* - New improvements to the :func:`.text` construct, includingMike Bayer2013-11-291-0/+348
more flexible ways to set up bound parameters and return types; in particular, a :func:`.text` can now be turned into a full FROM-object, embeddable in other statements as an alias or CTE using the new method :meth:`.TextClause.columns`. [ticket:2877]