11import logging
22from copy import deepcopy
3+ from typing import List
34
45import pymysql
56from PyMatcha import database_config
@@ -254,7 +255,7 @@ def get(cls, **kwargs):
254255 raise ValueError ("Not found." )
255256
256257 @classmethod
257- def get_multi (cls , ** kwargs ):
258+ def get_multi (cls , ** kwargs ) -> List :
258259 """
259260 Get a model from the database, using multiple keyword argument as a filter.
260261
@@ -309,7 +310,6 @@ def get_multis(cls, **kwargs):
309310 model = Model.get(username="test", email="test@example.org")
310311
311312 Returns list of instances on success and raises an error if the row count was 0
312-
313313 """
314314
315315 keys = []
@@ -321,11 +321,16 @@ def get_multis(cls, **kwargs):
321321 where = ""
322322 length = len (keys )
323323 for index , (key , value ) in enumerate (zip (keys , values )):
324- if index == length - 1 :
325- where = where + f"{ key } ={ value } "
324+ if isinstance (value , str ):
325+ if index == length - 1 :
326+ where = where + f"{ key } ='{ value } '"
327+ else :
328+ where = where + f"{ key } ='{ value } ' and "
326329 else :
327- where = where + f"{ key } ={ value } and "
328-
330+ if index == length - 1 :
331+ where = where + f"{ key } ={ value } "
332+ else :
333+ where = where + f"{ key } ={ value } and "
329334 temp = cls ()
330335 with temp .db .cursor () as c :
331336 c .execute (
0 commit comments