From eb6f1f87f6f632c16bde4b8e947f6e302e7c5c8b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 15 Oct 2009 23:00:06 +0000 Subject: deprecations per [ticket:1498]: - deprecated PassiveDefault - use DefaultClause. - the BINARY and MSBinary types now generate "BINARY" in all cases. Omitting the "length" parameter will generate "BINARY" with no length. Use BLOB to generate an unlengthed binary column. - the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. It's best to rely upon the automatic quoting. - "shortname" attribute on bindparam() is removed. - fold_equivalents flag on join is deprecated (will remain until [ticket:1131] is implemented) - "scalar" flag on select() is removed, use select.as_scalar(). - 'transactional' flag on sessionmaker() and others is removed. Use 'autocommit=True' to indicate 'transactional=False'. - 'polymorphic_fetch' argument on mapper() is removed. Loading can be controlled using the 'with_polymorphic' option. - 'select_table' argument on mapper() is removed. Use 'with_polymorphic=("*", )' for this functionality. - 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. - Passing a single list of elements to eagerload(), eagerload_all(), contains_eager(), lazyload(), defer(), and undefer() instead of multiple positional -args is deprecated. - Passing a single list of elements to query.order_by(), query.group_by(), query.join(), or query.outerjoin() instead of multiple positional *args is deprecated. - query.iterate_instances() is removed. Use query.instances(). - Query.query_from_parent() is removed. Use the sqlalchemy.orm.with_parent() function to produce a "parent" clause, or alternatively query.with_parent(). - query._from_self() is removed, use query.from_self() instead. - the "comparator" argument to composite() is removed. Use "comparator_factory". - RelationProperty._get_join() is removed. - the 'echo_uow' flag on Session is removed. Use logging on the "sqlalchemy.orm.unitofwork" name. - session.clear() is removed. use session.expunge_all(). - session.save(), session.update(), session.save_or_update() are removed. Use session.add() and session.add_all(). - the "objects" flag on session.flush() remains deprecated. - the "dont_load=True" flag on session.merge() is deprecated in favor of "load=False". - passing an InstanceState (internal SQLAlchemy state object) to attributes.init_collection() or attributes.get_history() is deprecated. These functions are public API and normally expect a regular mapped object instance. - the 'engine' parameter to declarative_base() is removed. Use the 'bind' keyword argument. --- lib/sqlalchemy/sql/expression.py | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 0a703ad36..6a8a2c17e 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -235,20 +235,8 @@ def select(columns=None, whereclause=None, from_obj=[], **kwargs): ``Connectable`` instances can be located within its contained ``ClauseElement`` members. - scalar=False - deprecated. Use select(...).as_scalar() to create a "scalar - column" proxy for an existing Select object. - """ - if 'scalar' in kwargs: - util.warn_deprecated( - 'scalar option is deprecated; see docs for details') - scalar = kwargs.pop('scalar', False) - s = Select(columns, whereclause=whereclause, from_obj=from_obj, **kwargs) - if scalar: - return s.as_scalar() - else: - return s + return Select(columns, whereclause=whereclause, from_obj=from_obj, **kwargs) def subquery(alias, *args, **kwargs): """Return an :class:`~sqlalchemy.sql.expression.Alias` object derived @@ -743,7 +731,7 @@ def table(name, *columns): """ return TableClause(name, *columns) -def bindparam(key, value=None, shortname=None, type_=None, unique=False, required=False): +def bindparam(key, value=None, type_=None, unique=False, required=False): """Create a bind parameter clause with the given key. value @@ -754,9 +742,6 @@ def bindparam(key, value=None, shortname=None, type_=None, unique=False, require a sqlalchemy.types.TypeEngine object indicating the type of this bind param, will invoke type-specific bind parameter processing - shortname - deprecated. - unique if True, bind params sharing the same name will have their underlying ``key`` modified to a uniquely generated name. @@ -767,9 +752,9 @@ def bindparam(key, value=None, shortname=None, type_=None, unique=False, require """ if isinstance(key, ColumnClause): - return _BindParamClause(key.name, value, type_=key.type, unique=unique, shortname=shortname, required=required) + return _BindParamClause(key.name, value, type_=key.type, unique=unique, required=required) else: - return _BindParamClause(key, value, type_=type_, unique=unique, shortname=shortname, required=required) + return _BindParamClause(key, value, type_=type_, unique=unique, required=required) def outparam(key, type_=None): """Create an 'OUT' parameter for usage in functions (stored procedures), for @@ -2074,7 +2059,7 @@ class _BindParamClause(ColumnElement): __visit_name__ = 'bindparam' quote = None - def __init__(self, key, value, type_=None, unique=False, isoutparam=False, shortname=None, required=False): + def __init__(self, key, value, type_=None, unique=False, isoutparam=False, required=False): """Construct a _BindParamClause. key @@ -2090,9 +2075,6 @@ class _BindParamClause(ColumnElement): overridden by the dictionary of parameters sent to statement compilation/execution. - shortname - deprecated. - type\_ A ``TypeEngine`` object that will be used to pre-process the value corresponding to this ``_BindParamClause`` at @@ -2120,7 +2102,6 @@ class _BindParamClause(ColumnElement): self.unique = unique self.value = value self.isoutparam = isoutparam - self.shortname = shortname self.required = required if type_ is None: @@ -2730,7 +2711,7 @@ class Join(FromClause): based on the join criterion of this :class:`Join`. This will recursively apply to any joins directly nested by this one as well. This flag is specific to a particular use case - by the ORM and will be deprecated in 0.6. + by the ORM and is deprecated as of 0.6. :param \**kwargs: all other kwargs are sent to the underlying :func:`select()` function. @@ -2740,6 +2721,7 @@ class Join(FromClause): global sql_util if not sql_util: from sqlalchemy.sql import util as sql_util + util.warn_deprecated("fold_equivalents is deprecated.") collist = sql_util.folded_equivalents(self) else: collist = [self.left, self.right] -- cgit v1.2.1