diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-15 23:00:06 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-15 23:00:06 +0000 |
| commit | eb6f1f87f6f632c16bde4b8e947f6e302e7c5c8b (patch) | |
| tree | bb16d8805115990e603fe1da93251f93ef5f1c3e /lib/sqlalchemy | |
| parent | 53f1c775db8f58ed33f3e35bbb3bd36961442c0c (diff) | |
| download | sqlalchemy-eb6f1f87f6f632c16bde4b8e947f6e302e7c5c8b.tar.gz | |
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=("*", <some selectable>)' 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.
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 11 | ||||
| -rw-r--r-- | lib/sqlalchemy/ext/declarative.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/__init__.py | 34 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/dynamic.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 37 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/properties.py | 19 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 39 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 61 | ||||
| -rw-r--r-- | lib/sqlalchemy/schema.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 32 | ||||
| -rw-r--r-- | lib/sqlalchemy/types.py | 14 |
13 files changed, 54 insertions, 213 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 8408e19ed..9b6671ece 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -840,8 +840,7 @@ class BINARY(_BinaryType): This is a fixed length type, and short values will be right-padded with a server-version-specific pad value. - :param length: Maximum data length, in bytes. If length is not - specified, this will generate a BLOB. This usage is deprecated. + :param length: Maximum data length, in bytes. """ super(BINARY, self).__init__(length=length, **kw) @@ -923,7 +922,7 @@ class ENUM(_StringType): character, then use 'quoted' mode. Otherwise, use 'unquoted' mode. 'quoted': values in enums are already quoted, they will be used - directly when generating the schema. + directly when generating the schema - this usage is deprecated. 'unquoted': values in enums are not quoted, they will be escaped and surrounded by single quotes when generating the schema. @@ -935,7 +934,7 @@ class ENUM(_StringType): """ self.quoting = kw.pop('quoting', 'auto') - if self.quoting == 'auto': + if self.quoting == 'auto' and len(enums): # What quoting character are we using? q = None for e in enums: @@ -952,7 +951,7 @@ class ENUM(_StringType): self.quoting = 'quoted' if self.quoting == 'quoted': - util.warn_pending_deprecation( + util.warn_deprecated( 'Manually quoting ENUM value literals is deprecated. Supply ' 'unquoted values and use the quoting= option in cases of ' 'ambiguity.') @@ -1572,7 +1571,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler): if type_.length: return "BINARY(%d)" % type_.length else: - return self.visit_BLOB(type_) + return "BINARY" def visit_BLOB(self, type_): if type_.length: diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 5d712df0f..816bcf3e8 100644 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -700,7 +700,7 @@ _declarative_constructor.__name__ = '__init__' def declarative_base(bind=None, metadata=None, mapper=None, cls=object, name='Base', constructor=_declarative_constructor, - metaclass=DeclarativeMeta, engine=None): + metaclass=DeclarativeMeta): """Construct a base class for declarative class definitions. The new base class will be given a metaclass that invokes @@ -710,7 +710,7 @@ def declarative_base(bind=None, metadata=None, mapper=None, cls=object, :param bind: An optional :class:`~sqlalchemy.engine.base.Connectable`, will be assigned the ``bind`` attribute on the :class:`~sqlalchemy.MetaData` instance. - The `engine` keyword argument is a deprecated synonym for `bind`. + :param metadata: An optional :class:`~sqlalchemy.MetaData` instance. All :class:`~sqlalchemy.schema.Table` @@ -747,8 +747,8 @@ def declarative_base(bind=None, metadata=None, mapper=None, cls=object, """ lcl_metadata = metadata or MetaData() - if bind or engine: - lcl_metadata.bind = bind or engine + if bind: + lcl_metadata.bind = bind bases = not isinstance(cls, tuple) and (cls,) or cls class_dict = dict(_decl_class_registry=dict(), diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py index a343dffb8..7d54c7320 100644 --- a/lib/sqlalchemy/orm/__init__.py +++ b/lib/sqlalchemy/orm/__init__.py @@ -167,14 +167,6 @@ def create_session(bind=None, **kwargs): create_session(). """ - if 'transactional' in kwargs: - sa_util.warn_deprecated( - "The 'transactional' argument to sessionmaker() is deprecated; " - "use autocommit=True|False instead.") - if 'autocommit' in kwargs: - raise TypeError('Specify autocommit *or* transactional, not both.') - kwargs['autocommit'] = not kwargs.pop('transactional') - kwargs.setdefault('autoflush', False) kwargs.setdefault('autocommit', True) kwargs.setdefault('expire_on_commit', False) @@ -688,10 +680,6 @@ def mapper(class_, local_table=None, *args, **params): A value which will be stored in the Column denoted by polymorphic_on, corresponding to the *class identity* of this mapper. - polymorphic_fetch - Deprecated. Unloaded columns load as deferred in all cases; loading - can be controlled using the "with_polymorphic" option. - properties A dictionary mapping the string names of object attributes to ``MapperProperty`` instances, which define the persistence behavior of @@ -735,10 +723,6 @@ def mapper(class_, local_table=None, *args, **params): <selectable> argument is required, since it usually requires more complex UNION queries. - select_table - Deprecated. Synonymous with - ``with_polymorphic=('*', <selectable>)``. - version_id_col A ``Column`` which must have an integer type that will be used to keep a running *version id* of mapped entities in the database. this is @@ -749,7 +733,7 @@ def mapper(class_, local_table=None, *args, **params): """ return Mapper(class_, local_table, *args, **params) -def synonym(name, map_column=False, descriptor=None, comparator_factory=None, proxy=False): +def synonym(name, map_column=False, descriptor=None, comparator_factory=None): """Set up `name` as a synonym to another mapped property. Used with the ``properties`` dictionary sent to :func:`~sqlalchemy.orm.mapper`. @@ -786,10 +770,6 @@ def synonym(name, map_column=False, descriptor=None, comparator_factory=None, pr ``_status``, and the ``status`` attribute on ``MyClass`` will be used to proxy access to the column-based attribute. - The `proxy` keyword argument is deprecated and currently does nothing; - synonyms now always establish an attribute getter/setter function if one - is not already available. - """ return SynonymProperty(name, map_column=map_column, descriptor=descriptor, comparator_factory=comparator_factory) @@ -868,7 +848,7 @@ def extension(ext): """ return ExtensionOption(ext) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def eagerload(*keys): """Return a ``MapperOption`` that will convert the property of the given name into an eager load. @@ -878,7 +858,7 @@ def eagerload(*keys): """ return strategies.EagerLazyOption(keys, lazy=False) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def eagerload_all(*keys): """Return a ``MapperOption`` that will convert all properties along the given dot-separated path into an eager load. @@ -895,7 +875,7 @@ def eagerload_all(*keys): """ return strategies.EagerLazyOption(keys, lazy=False, chained=True) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def lazyload(*keys): """Return a ``MapperOption`` that will convert the property of the given name into a lazy load. @@ -924,7 +904,7 @@ def contains_alias(alias): """ return AliasOption(alias) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def contains_eager(*keys, **kwargs): """Return a ``MapperOption`` that will indicate to the query that the given attribute will be eagerly loaded. @@ -944,7 +924,7 @@ def contains_eager(*keys, **kwargs): return (strategies.EagerLazyOption(keys, lazy=False, propagate_to_loaders=False), strategies.LoadEagerFromAliasOption(keys, alias=alias)) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def defer(*keys): """Return a ``MapperOption`` that will convert the column property of the given name into a deferred load. @@ -953,7 +933,7 @@ def defer(*keys): """ return strategies.DeferredOption(keys, defer=True) -@sa_util.accepts_a_list_as_starargs(list_deprecation='pending') +@sa_util.accepts_a_list_as_starargs(list_deprecation='deprecated') def undefer(*keys): """Return a ``MapperOption`` that will convert the column property of the given name into a non-deferred (regular column) load. diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 6fa8d54c4..efbc15d7f 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -1293,6 +1293,8 @@ HISTORY_BLANK = History(None, None, None) def _conditional_instance_state(obj): if not isinstance(obj, state.InstanceState): obj = instance_state(obj) + else: + util.warn_deprecated("Passing an InstanceState to get_history() or init_collection() is deprecated.") return obj def get_history(obj, key, **kwargs): diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index 0bc7bab24..3cd0bf8c0 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -236,7 +236,7 @@ class AppenderMixin(object): query = query.with_parent(instance, self.attr.key) if self.attr.order_by: - query = query.order_by(self.attr.order_by) + query = query.order_by(*self.attr.order_by) return query def append(self, item): diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index b15abc114..6bc55c831 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -87,9 +87,7 @@ class Mapper(object): polymorphic_on=None, _polymorphic_map=None, polymorphic_identity=None, - polymorphic_fetch=None, concrete=False, - select_table=None, with_polymorphic=None, allow_null_pks=None, batch=True, @@ -140,27 +138,17 @@ class Mapper(object): if allow_null_pks: util.warn_deprecated('the allow_null_pks option to Mapper() is deprecated. It is now on in all cases.') - self.select_table = select_table - if select_table: - util.warn_deprecated('select_table option is deprecated. Use with_polymorphic=("*", selectable) ' - 'instead.') - - if with_polymorphic: - raise sa_exc.ArgumentError("select_table can't be used with " - "with_polymorphic (they define conflicting settings)") - self.with_polymorphic = ('*', select_table) - else: - if with_polymorphic == '*': - self.with_polymorphic = ('*', None) - elif isinstance(with_polymorphic, (tuple, list)): - if isinstance(with_polymorphic[0], (basestring, tuple, list)): - self.with_polymorphic = with_polymorphic - else: - self.with_polymorphic = (with_polymorphic, None) - elif with_polymorphic is not None: - raise sa_exc.ArgumentError("Invalid setting for with_polymorphic") + if with_polymorphic == '*': + self.with_polymorphic = ('*', None) + elif isinstance(with_polymorphic, (tuple, list)): + if isinstance(with_polymorphic[0], (basestring, tuple, list)): + self.with_polymorphic = with_polymorphic else: - self.with_polymorphic = None + self.with_polymorphic = (with_polymorphic, None) + elif with_polymorphic is not None: + raise sa_exc.ArgumentError("Invalid setting for with_polymorphic") + else: + self.with_polymorphic = None if isinstance(self.local_table, expression._SelectBaseMixin): raise sa_exc.InvalidRequestError( @@ -175,11 +163,6 @@ class Mapper(object): # indicates this Mapper should be used to construct the object instance for that row. self.polymorphic_identity = polymorphic_identity - if polymorphic_fetch: - util.warn_deprecated('polymorphic_fetch option is deprecated. Unloaded columns ' - 'load as deferred in all cases; loading can be controlled ' - 'using the "with_polymorphic" option.') - # a dictionary of 'polymorphic identity' names, associating those names with # Mappers that will be used to construct object instances upon a select operation. if _polymorphic_map is None: diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index b99ce093a..1def36c19 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -143,9 +143,6 @@ class CompositeProperty(ColumnProperty): """subclasses ColumnProperty to provide composite type support.""" def __init__(self, class_, *columns, **kwargs): - if 'comparator' in kwargs: - util.warn_deprecated("The 'comparator' argument to CompositeProperty is deprecated. Use comparator_factory.") - kwargs['comparator_factory'] = kwargs['comparator'] super(CompositeProperty, self).__init__(*columns, **kwargs) self._col_position_map = util.column_dict((c, i) for i, c in enumerate(columns)) self.composite_class = class_ @@ -645,7 +642,7 @@ class RelationProperty(StrategizedProperty): if obj is not None: dest_list.append(obj) if not load: - coll = attributes.init_collection(dest_state, self.key) + coll = attributes.init_state_collection(dest_state, dest_dict, self.key) for c in dest_list: coll.append_without_event(c) else: @@ -1153,20 +1150,6 @@ class RelationProperty(StrategizedProperty): source_selectable, dest_selectable, secondary, target_adapter) - def _get_join(self, parent, primary=True, secondary=True, polymorphic_parent=True): - """deprecated. use primary_join_against(), secondary_join_against(), full_join_against()""" - - pj, sj, source, dest, secondarytable, adapter = self._create_joins(source_polymorphic=polymorphic_parent) - - if primary and secondary: - return pj & sj - elif primary: - return pj - elif secondary: - return sj - else: - raise AssertionError("illegal condition") - def register_dependencies(self, uowcommit): if not self.viewonly: self._dependency_processor.register_dependencies(uowcommit) diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index d5f21c7e0..9573b0674 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -508,34 +508,6 @@ class Query(object): ).identity_key_from_primary_key(ident) return self._get(key, ident) - @classmethod - @util.deprecated('Deprecated. Use sqlalchemy.orm.with_parent ' - 'in conjunction with filter().') - def query_from_parent(cls, instance, property, **kwargs): - """Return a new Query with criterion corresponding to a parent instance. - - Return a newly constructed Query object, with criterion corresponding - to a relationship to the given parent instance. - - instance - a persistent or detached instance which is related to class - represented by this query. - - property - string name of the property which relates this query's class to the - instance. - - \**kwargs - all extra keyword arguments are propagated to the constructor of - Query. - - """ - mapper = object_mapper(instance) - prop = mapper.get_property(property, resolve_synonyms=True) - target = prop.mapper - criterion = prop.compare(operators.eq, instance, value_is_parent=True) - return Query(target, **kwargs).filter(criterion) - @_generative() def correlate(self, *args): self._correlate = self._correlate.union(_orm_selectable(s) for s in args) @@ -626,8 +598,6 @@ class Query(object): q._set_entities(entities) return q - _from_self = from_self - @_generative() def _from_selectable(self, fromclause): self._statement = self._criterion = None @@ -750,7 +720,7 @@ class Query(object): @_generative(_no_statement_condition, _no_limit_offset) - @util.accepts_a_list_as_starargs(list_deprecation='pending') + @util.accepts_a_list_as_starargs(list_deprecation='deprecated') def order_by(self, *criterion): """apply one or more ORDER BY criterion to the query and return the newly resulting ``Query``""" @@ -765,7 +735,7 @@ class Query(object): self._order_by = self._order_by + criterion @_generative(_no_statement_condition, _no_limit_offset) - @util.accepts_a_list_as_starargs(list_deprecation='pending') + @util.accepts_a_list_as_starargs(list_deprecation='deprecated') def group_by(self, *criterion): """apply one or more GROUP BY criterion to the query and return the newly resulting ``Query``""" @@ -883,7 +853,7 @@ class Query(object): expression.except_all(*([self]+ list(q))) ) - @util.accepts_a_list_as_starargs(list_deprecation='pending') + @util.accepts_a_list_as_starargs(list_deprecation='deprecated') def join(self, *props, **kwargs): """Create a join against this ``Query`` object's criterion and apply generatively, returning the newly resulting ``Query``. @@ -950,7 +920,7 @@ class Query(object): raise TypeError("unknown arguments: %s" % ','.join(kwargs.iterkeys())) return self._join(props, outerjoin=False, create_aliases=aliased, from_joinpoint=from_joinpoint) - @util.accepts_a_list_as_starargs(list_deprecation='pending') + @util.accepts_a_list_as_starargs(list_deprecation='deprecated') def outerjoin(self, *props, **kwargs): """Create a left outer join against this ``Query`` object's criterion and apply generatively, retunring the newly resulting ``Query``. @@ -1417,7 +1387,6 @@ class Query(object): if not self._yield_per: break - iterate_instances = util.deprecated()(instances) def _get(self, key=None, ident=None, refresh_state=None, lockmode=None, only_load_props=None, passive=None): lockmode = lockmode or self._lockmode diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 760dfe81f..d68840c51 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -122,10 +122,6 @@ def sessionmaker(bind=None, class_=None, autoflush=True, autocommit=False, that is local to the ``sessionmaker()`` function, and is not sent directly to the constructor for ``Session``. - echo_uow - Deprecated. Use - ``logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG)``. - _enable_transaction_accounting Defaults to ``True``. A legacy-only flag which when ``False`` disables *all* 0.5-style object accounting on transaction boundaries, @@ -169,12 +165,6 @@ def sessionmaker(bind=None, class_=None, autoflush=True, autocommit=False, present until they are removed using expunge(), clear(), or purge(). """ - if 'transactional' in kwargs: - util.warn_deprecated( - "The 'transactional' argument to sessionmaker() is deprecated; " - "use autocommit=True|False instead.") - autocommit = not kwargs.pop('transactional') - kwargs['bind'] = bind kwargs['autoflush'] = autoflush kwargs['autocommit'] = autocommit @@ -525,14 +515,14 @@ class Session(object): public_methods = ( '__contains__', '__iter__', 'add', 'add_all', 'begin', 'begin_nested', - 'clear', 'close', 'commit', 'connection', 'delete', 'execute', 'expire', + 'close', 'commit', 'connection', 'delete', 'execute', 'expire', 'expire_all', 'expunge', 'expunge_all', 'flush', 'get_bind', 'is_modified', - 'merge', 'query', 'refresh', 'rollback', 'save', - 'save_or_update', 'scalar', 'update') + 'merge', 'query', 'refresh', 'rollback', + 'scalar') def __init__(self, bind=None, autoflush=True, expire_on_commit=True, _enable_transaction_accounting=True, - autocommit=False, twophase=False, echo_uow=None, + autocommit=False, twophase=False, weak_identity_map=True, binds=None, extension=None, query_cls=query.Query): """Construct a new Session. @@ -541,12 +531,6 @@ class Session(object): """ - if echo_uow is not None: - util.warn_deprecated( - "echo_uow is deprecated. " - "Use logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG).") - log.class_logger(UOWTransaction, echo_uow) - if weak_identity_map: self._identity_cls = identity.WeakInstanceDict else: @@ -795,8 +779,6 @@ class Session(object): self._new = {} self._deleted = {} - clear = util.deprecated("Use session.expunge_all()")(expunge_all) - # TODO: need much more test coverage for bind_mapper() and similar ! # TODO: + crystalize + document resolution order vis. bind_mapper/bind_table @@ -1039,44 +1021,12 @@ class Session(object): self.identity_map.discard(state) self._deleted.pop(state, None) - @util.deprecated("Use session.add()") - def save(self, instance): - """Add a transient (unsaved) instance to this ``Session``. - - This operation cascades the `save_or_update` method to associated - instances if the relation is mapped with ``cascade="save-update"``. - - - """ - state = _state_for_unsaved_instance(instance) - self._save_impl(state) - self._cascade_save_or_update(state) - def _save_without_cascade(self, instance): """Used by scoping.py to save on init without cascade.""" state = _state_for_unsaved_instance(instance, create=True) self._save_impl(state) - @util.deprecated("Use session.add()") - def update(self, instance): - """Bring a detached (saved) instance into this ``Session``. - - If there is a persistent instance with the same instance key, but - different identity already associated with this ``Session``, an - InvalidRequestError exception is thrown. - - This operation cascades the `save_or_update` method to associated - instances if the relation is mapped with ``cascade="save-update"``. - - """ - try: - state = attributes.instance_state(instance) - except exc.NO_STATE: - raise exc.UnmappedInstanceError(instance) - self._update_impl(state) - self._cascade_save_or_update(state) - def add(self, instance): """Place an object in the ``Session``. @@ -1100,9 +1050,6 @@ class Session(object): self._save_or_update_impl(state) self._cascade_save_or_update(state) - save_or_update = ( - util.deprecated("Use session.add()")(add)) - def _cascade_save_or_update(self, state): for state, mapper in _cascade_unknown_state_iterator('save-update', state, halt_on=lambda c:c in self): self._save_or_update_impl(state) diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 9798fc23a..5b63f6e29 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1235,8 +1235,10 @@ class DefaultClause(FetchedValue): def __repr__(self): return "DefaultClause(%r, for_update=%r)" % (self.arg, self.for_update) -# alias; deprecated starting 0.5.0 -PassiveDefault = DefaultClause +class PassiveDefault(DefaultClause): + def __init__(self, *arg, **kw): + util.warn_deprecated("PassiveDefault is deprecated. Use DefaultClause.") + DefaultClause.__init__(self, *arg, **kw) class Constraint(SchemaItem): """A table-level SQL constraint.""" diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index b204f42b1..59034ca22 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -237,7 +237,7 @@ class SQLCompiler(engine.Compiled): if params: pd = {} for bindparam, name in self.bind_names.iteritems(): - for paramname in (bindparam.key, bindparam.shortname, name): + for paramname in (bindparam.key, name): if paramname in params: pd[name] = params[paramname] break 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] diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 9fa59600f..9ae034c41 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -819,19 +819,13 @@ class PickleType(MutableType, TypeDecorator): :param mutable: defaults to True; implements :meth:`AbstractType.is_mutable`. When ``True``, incoming - objects *must* provide an ``__eq__()`` method which + objects should provide an ``__eq__()`` method which performs the desired deep comparison of members, or the - ``comparator`` argument must be present. Otherwise, - comparisons are done by comparing pickle strings. - The pickle form of comparison is a deprecated usage and will - raise a warning. + ``comparator`` argument must be present. :param comparator: optional. a 2-arg callable predicate used - to compare values of this type. Otherwise, either - the == operator is used to compare values, or if mutable==True - and the incoming object does not implement __eq__(), the value - of pickle.dumps(obj) is compared. The last option is a deprecated - usage and will raise a warning. + to compare values of this type. Otherwise, + the == operator is used to compare values. """ self.protocol = protocol |
