Index('my_index', my_table.c.id, postgresql_where=tbl.c.value > 10)
-
-
"""
import re
__visit_name__ = 'ARRAY'
def __init__(self, item_type, mutable=True):
+ """Construct an ARRAY.
+
+ E.g.::
+
+ Column('myarray', ARRAY(Integer))
+
+ Arguments are:
+
+ :param item_type: The data type of items of this array. Note that dimensionality is
+ irrelevant here, so multi-dimensional arrays like ``INTEGER[][]``, are constructed as
+ ``ARRAY(Integer)``, not as ``ARRAY(ARRAY(Integer))`` or such. The type mapping figures
+ out on the fly
+
+ :param mutable: Defaults to True: specify whether lists passed to this class should be
+ considered mutable. If so, generic copy operations (typically used by the ORM) will
+ shallow-copy values.
+
+ """
+ if isinstance(item_type, ARRAY):
+ raise ValueError("Do not nest ARRAY types; ARRAY(basetype) "
+ "handles multi-dimensional arrays of basetype")
if isinstance(item_type, type):
item_type = item_type()
self.item_type = item_type
if coltype:
coltype = coltype(*args, **kwargs)
if is_array:
- coltype = PGArray(coltype)
+ coltype = ARRAY(coltype)
else:
util.warn("Did not recognize type '%s' of column '%s'" %
(attype, name))
"""Transform a generic type to a dialect-specific type.
Dialect classes will usually use the
- :func:`~sqlalchemy.types.adapt_type` method in the types module to
+ :func:`~sqlalchemy.types.adapt_type` function in the types module to
make this job easy.
The returned result is cached *per dialect class* so can
raise NotImplementedError()
+ def get_rowcount(self):
+ """Return the number of rows produced (by a SELECT query)
+ or affected (by an INSERT/UPDATE/DELETE statement).
+
+ Note that this row count may not be properly implemented
+ in some dialects; this is indicated by the
+ ``supports_sane_rowcount`` and ``supports_sane_multi_rowcount``
+ dialect attributes.
+
+ """
+
+ raise NotImplementedError()
+
class Compiled(object):
"""Represent a compiled SQL or DDL expression.
uses and is not intended to provide the number of rows
present from a SELECT.
- Additionally, this value is only meaningful if the
- dialect's supports_sane_rowcount flag is True for
- single-parameter executions, or supports_sane_multi_rowcount
- is true for multiple parameter executions - otherwise
- results are undefined.
+ Note that this row count may not be properly implemented
+ in some dialects; this is indicated by
+ :meth:`~sqlalchemy.engine.base.ResultProxy.supports_sane_rowcount()` and
+ :meth:`~sqlalchemy.engine.base.ResultProxy.supports_sane_multi_rowcount()`.
- rowcount may not work at this time for a statement
+ ``rowcount()`` also may not work at this time for a statement
that uses ``returning()``.
"""