diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-01 17:20:49 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-01 17:20:49 -0400 |
commit | 382f82538b5484b1c384c71fbf84438312cbe34f (patch) | |
tree | 617497513af95990c33863103caa112939b7e241 /lib/sqlalchemy/sql/elements.py | |
parent | 62d81c2ebdb6b5a4d975fdb84d05398550490142 (diff) | |
download | sqlalchemy-382f82538b5484b1c384c71fbf84438312cbe34f.tar.gz |
- more updates to text docs, literal_column, column etc. in prep
for ticket 2992.
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 6cbf583cc..8cae83169 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2133,14 +2133,15 @@ class Case(ColumnElement): def literal_column(text, type_=None): - """Return a textual column expression, as would be in the columns - clause of a ``SELECT`` statement. - - The object returned supports further expressions in the same way as any - other column object, including comparison, math and string operations. - The type\_ parameter is important to determine proper expression behavior - (such as, '+' means string concatenation or numerical addition based on - the type). + """Produce a :class:`.ColumnClause` object that has the + :paramref:`.column.is_literal` flag set to True. + + :func:`.literal_column` is similar to :func:`.column`, except that + it is more often used as a "standalone" column expression that renders + exactly as stated; while :func:`.column` stores a string name that + will be assumed to be part of a table and may be quoted as such, + :func:`.literal_column` can be that, or any other arbitrary column-oriented + expression. :param text: the text of the expression; can be any SQL expression. Quoting rules will not be applied. To specify a column-name expression @@ -2152,6 +2153,14 @@ def literal_column(text, type_=None): provide result-set translation and additional expression semantics for this column. If left as None the type will be NullType. + .. seealso:: + + :func:`.column` + + :func:`.text` + + :ref:`sqlexpression_literal_column` + """ return ColumnClause(text, type_=type_, is_literal=True) @@ -2965,9 +2974,11 @@ class ColumnClause(Immutable, ColumnElement): :func:`.literal_column` + :func:`.table` + :func:`.text` - :ref:`metadata_toplevel` + :ref:`sqlexpression_literal_column` """ |