@@ -894,6 +894,7 @@ async def subscribe(
894894 >>> subscription_context.cancel()
895895
896896 """
897+ query ._prepare_sorts ()
897898 subscription_context = SubscriptionContext ()
898899
899900 async def _poll_loop () -> None :
@@ -968,10 +969,11 @@ def _create_other_params(
968969 f"Received in `sources` argument for views: { with_properties } ."
969970 )
970971 if sort :
971- if isinstance (sort , (InstanceSort , dict )):
972- other_params ["sort" ] = [cls ._dump_instance_sort (sort )]
973- else :
974- other_params ["sort" ] = [cls ._dump_instance_sort (s ) for s in sort ]
972+ sorts_seq = [sort ] if isinstance (sort , (InstanceSort , dict )) else list (sort )
973+ for s in sorts_seq :
974+ if isinstance (s , InstanceSort ):
975+ s ._apply_postgres_defaults_or_maybe_warn ()
976+ other_params ["sort" ] = [cls ._dump_instance_sort (s ) for s in sorts_seq ]
975977 if instance_type :
976978 other_params ["instanceType" ] = instance_type
977979 if debug :
@@ -1647,6 +1649,7 @@ async def query(
16471649 >>> res = client.data_modeling.instances.query(query, debug=debug_params)
16481650 >>> print(res.debug)
16491651 """
1652+ query ._prepare_sorts ()
16501653 return await self ._query_or_sync (query , "query" , include_typing = include_typing , debug = debug )
16511654
16521655 async def sync (
@@ -1749,6 +1752,7 @@ async def sync(
17491752 >>> res = client.data_modeling.instances.sync(query, debug=debug_params)
17501753 >>> print(res.debug)
17511754 """
1755+ query ._prepare_sorts ()
17521756 return await self ._query_or_sync (query , "sync" , include_typing = include_typing , debug = debug )
17531757
17541758 async def _query_or_sync (
0 commit comments