diff --git a/pypika/terms.py b/pypika/terms.py index 7d0d0d1..d75208f 100644 --- a/pypika/terms.py +++ b/pypika/terms.py @@ -1429,7 +1429,7 @@ def get_sql(self, **kwargs: Any) -> str: # FIXME escape function_sql = self.get_function_sql( - with_namespace=with_namespace, quote_char=quote_char, dialect=dialect + with_namespace=with_namespace, quote_char=quote_char, dialect=dialect, **kwargs ) if self.schema is not None: diff --git a/tests/test_parameter.py b/tests/test_parameter.py index 920803a..037618f 100644 --- a/tests/test_parameter.py +++ b/tests/test_parameter.py @@ -11,7 +11,8 @@ Query, Tables, ) -from pypika.terms import ListParameter, ParameterValueWrapper +from pypika.functions import Upper +from pypika.terms import ListParameter, ParameterValueWrapper, ValueWrapper class ParametrizedTests(unittest.TestCase): @@ -212,3 +213,18 @@ def test_pyformat_parameter(self): 'INSERT INTO "abc" ("a","b","c") VALUES (%(param1)s,%(param2)s,%(param3)s)', sql ) self.assertEqual({"param1": 1, "param2": 2.2, "param3": "foo"}, parameter.get_parameters()) + + def test_function_parameter(self): + q = ( + Query + .from_(self.table_abc) + .select("*") + .where(self.table_abc.category == Upper(ValueWrapper("foobar"))) + ) + p = ListParameter("%s") + sql = q.get_sql(parameter=p) + self.assertEqual( + 'SELECT * FROM "abc" WHERE "category"=UPPER(%s)', sql + ) + + self.assertEqual(["foobar"], p.get_parameters()) \ No newline at end of file