summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-10-25 00:40:34 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-10-25 00:40:34 +0000
commitaa557982fa2518e6d520ce17894093d5ed03c0eb (patch)
tree5bc55ac2aa8d33de635c380f775e642c52bc7d8c /lib/sqlalchemy/sql/expression.py
parent82ea898ab06063ebac631f4e375331550a226687 (diff)
downloadsqlalchemy-aa557982fa2518e6d520ce17894093d5ed03c0eb.tar.gz
- Added new ENUM type to the Postgresql dialect, which exists as a schema-level
construct and extends the generic Enum type. Automatically associates itself with tables and their parent metadata to issue the appropriate CREATE TYPE/DROP TYPE commands as needed, supports unicode labels, supports reflection. [ticket:1511] - MySQL ENUM now subclasses the new generic Enum type, and also handles unicode values implicitly, if the given labelnames are unicode objects. - Added a new Enum generic type, currently supported on Postgresql and MySQL. Enum is a schema-aware object to support databases which require specific DDL in order to use enum or equivalent; in the case of PG it handles the details of `CREATE TYPE`, and on other databases without native enum support can support generation of CHECK constraints. [ticket:1109] [ticket:1511] - types documentation updates - some cleanup on schema/expression docs
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r--lib/sqlalchemy/sql/expression.py55
1 files changed, 23 insertions, 32 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 6a8a2c17e..b71c1892b 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -1187,43 +1187,32 @@ class ClauseElement(Visitable):
"""Compile this SQL expression.
The return value is a :class:`~sqlalchemy.engine.Compiled` object.
- Calling `str()` or `unicode()` on the returned value will yield a string
- representation of the result. The :class:`~sqlalchemy.engine.Compiled`
- object also can return a dictionary of bind parameter names and values
- using the `params` accessor.
+ Calling ``str()`` or ``unicode()`` on the returned value will yield a
+ string representation of the result. The
+ :class:`~sqlalchemy.engine.Compiled` object also can return a
+ dictionary of bind parameter names and values
+ using the ``params`` accessor.
:param bind: An ``Engine`` or ``Connection`` from which a
- ``Compiled`` will be acquired. This argument
- takes precedence over this ``ClauseElement``'s
- bound engine, if any.
+ ``Compiled`` will be acquired. This argument takes precedence over
+ this ``ClauseElement``'s bound engine, if any.
+
+ :param column_keys: Used for INSERT and UPDATE statements, a list of
+ column names which should be present in the VALUES clause of the
+ compiled statement. If ``None``, all columns from the target table
+ object are rendered.
:param dialect: A ``Dialect`` instance frmo which a ``Compiled``
- will be acquired. This argument takes precedence
- over the `bind` argument as well as this
- ``ClauseElement``'s bound engine, if any.
+ will be acquired. This argument takes precedence over the `bind`
+ argument as well as this ``ClauseElement``'s bound engine, if any.
- \**kw
-
- Keyword arguments are passed along to the compiler,
- which can affect the string produced.
-
- Keywords for a statement compiler are:
-
- column_keys
- Used for INSERT and UPDATE statements, a list of
- column names which should be present in the VALUES clause
- of the compiled statement. If ``None``, all columns
- from the target table object are rendered.
-
- inline
- Used for INSERT statements, for a dialect which does
- not support inline retrieval of newly generated
- primary key columns, will force the expression used
- to create the new primary key value to be rendered
- inline within the INSERT statement's VALUES clause.
- This typically refers to Sequence execution but
- may also refer to any server-side default generation
- function associated with a primary key `Column`.
+ :param inline: Used for INSERT statements, for a dialect which does
+ not support inline retrieval of newly generated primary key
+ columns, will force the expression used to create the new primary
+ key value to be rendered inline within the INSERT statement's
+ VALUES clause. This typically refers to Sequence execution but may
+ also refer to any server-side default generation function
+ associated with a primary key `Column`.
"""
@@ -3114,6 +3103,8 @@ class TableClause(_Immutable, FromClause):
return []
def count(self, whereclause=None, **params):
+ """return a SELECT COUNT generated against this ``TableClause``."""
+
if self.primary_key:
col = list(self.primary_key)[0]
else: