@@ -235,6 +235,8 @@ class Alias:
235235
236236 """
237237
238+ is_clause_element = False
239+
238240 def __init__ (self , model , * args , ** kwargs ):
239241 # noinspection PyProtectedMember
240242 model ._check_abstract ()
@@ -257,6 +259,9 @@ def __iter__(self):
257259 def __call__ (self , * args , ** kwargs ):
258260 return self .model (* args , ** kwargs )
259261
262+ def __clause_element__ (self ):
263+ return self .alias
264+
260265 def load (self , * column_names , ** relationships ):
261266 return AliasLoader (self , * column_names , ** relationships )
262267
@@ -267,12 +272,6 @@ def distinct(self, *columns):
267272 return self .load ().distinct (* columns )
268273
269274
270- # noinspection PyProtectedMember
271- @sa .inspection ._inspects (Alias )
272- def _inspect_alias (target ):
273- return sa .inspection .inspect (target .alias )
274-
275-
276275class CRUDModel (Model ):
277276 """
278277 The base class for models with CRUD support.
@@ -598,7 +597,7 @@ async def _delete(self, bind=None, timeout=DEFAULT):
598597 clause = clause .execution_options (timeout = timeout )
599598 if bind is None :
600599 bind = self .__metadata__ .bind
601- return ( await bind .status (clause ))[ 0 ]
600+ return await bind .status (clause )
602601
603602 def to_dict (self ):
604603 """
0 commit comments