@@ -50,7 +50,7 @@ def resolve_wheres(
5050 model : Optional [Model ] = None ,
5151 ) -> str :
5252 if not model and not isinstance (wheres , str ):
53- raise WrongParamsError ("Parameter `wheres` only support str type if no model passed " )
53+ raise WrongParamsError ("Parameter `wheres` only supports str if no model exists " )
5454
5555 if isinstance (wheres , str ):
5656 return wheres
@@ -61,10 +61,10 @@ def resolve_wheres(
6161 elif isinstance (wheres , list ):
6262 qs = [q for q in wheres if isinstance (q , Q )]
6363 else :
64- raise WrongParamsError ("Parameter `wheres` only supports str, dict and list type " )
64+ raise WrongParamsError ("Parameter `wheres` only support str, Q, Dict[str, Any] and List[Q] " )
6565
6666 if not qs :
67- raise QsParsingError ("Parsing `wheres` for qs failed! " )
67+ raise QsParsingError ("Parsing `wheres` for QuerySet failed" )
6868
6969 modifier = QueryModifier ()
7070 for q in qs :
@@ -122,9 +122,9 @@ def select_custom_fields(
122122 model : Optional [Model ] = None ,
123123 ) -> Optional [str ]:
124124 if not all ([table , fields , wheres ]):
125- raise WrongParamsError ("Please check your params " )
125+ raise WrongParamsError ("Parameters `table`, `fields`, `wheres` are required " )
126126 if having and not groups :
127- raise WrongParamsError ("Parameter `groups` shoud be no empty when `having` isn't " )
127+ raise WrongParamsError ("Parameter `groups` shoud not be empty if `having` exists " )
128128
129129 group_by = f" GROUP BY { ', ' .join (groups )} " if groups else ""
130130 having_ = f" HAVING { having } " if having else ""
@@ -160,9 +160,11 @@ def update_json_field(
160160 model : Optional [Model ] = None ,
161161 ) -> Optional [str ]:
162162 if not all ([table , json_field , wheres ]):
163- raise WrongParamsError ("Please check your params " )
163+ raise WrongParamsError ("Parameters `table`, `json_field`, `wheres` are required " )
164164 if not any ([merge_dict , path_value_dict , remove_paths ]):
165- raise WrongParamsError ("Please check your params" )
165+ raise WrongParamsError (
166+ "At least one no empty parameter is required between `merge_dict`, `path_value_dict` and `remove_paths`"
167+ )
166168
167169 json_obj = f"COALESCE({ json_field } , '{ json_type ()} ')"
168170 if remove_paths :
@@ -195,7 +197,7 @@ def upsert_on_duplicate(
195197 using_values : bool = False ,
196198 ) -> Optional [str ]:
197199 if not all ([table , dicts , insert_fields , upsert_fields ]):
198- raise WrongParamsError ("Please check your params " )
200+ raise WrongParamsError ("Parameters `table`, `dicts`, `insert_fields`, `upsert_fields` are required " )
199201
200202 values = [
201203 f" ({ ', ' .join (cls .sqlize_value (d .get (f )) for f in insert_fields )} )"
@@ -236,8 +238,10 @@ def insert_into_select(
236238 to_table : Optional [str ] = None ,
237239 model : Optional [Model ] = None ,
238240 ) -> Optional [str ]:
239- if not all ([table , wheres ] or not any ([remain_fields , assign_field_dict ])):
240- raise WrongParamsError ("Please check your params" )
241+ if not all ([table , wheres ]):
242+ raise WrongParamsError ("Parameters `table`, `wheres` are required" )
243+ if not any ([remain_fields , assign_field_dict ]):
244+ raise WrongParamsError ("At least one no empty parameter is required between `remain_fields` and `assign_field_dict`" )
241245
242246 fields = [* remain_fields ]
243247 assign_fields = []
@@ -263,7 +267,7 @@ def build_fly_table(
263267 using_values : bool = True ,
264268 ) -> Optional [str ]:
265269 if not all ([dicts , fields ]):
266- raise WrongParamsError ("Please check your params " )
270+ raise WrongParamsError ("Parameters `dicts`, `fields` are required " )
267271
268272 if using_values :
269273 rows = [
@@ -297,7 +301,7 @@ def bulk_update_from_dicts(
297301 using_values : bool = True ,
298302 ) -> Optional [str ]:
299303 if not all ([table , dicts , join_fields , update_fields ]):
300- raise WrongParamsError ("Please check your params " )
304+ raise WrongParamsError ("Parameters `table`, `dicts`, `join_fields`, `update_fields` are required " )
301305
302306 joins = [f"{ table } .{ jf } =tmp.{ jf } " for jf in join_fields ]
303307 updates = [f"{ table } .{ uf } =tmp.{ uf } " for uf in update_fields ]
0 commit comments