データベース (Postgres) に次のような関数があります。
create function test_f(a text default '*', b text default '+') returns text as $$
select a || ' ' || b;
$$ language sql;
Postgres では、名前付きパラメーターを使用して呼び出すことができます。
mytest=> select test_f('a', 'b');
test_f
--------
a b
(1 row)
mytest=> select test_f('a');
test_f
--------
a +
(1 row)
mytest=> select test_f(b:='a');
test_f
--------
* a
(1 row)
SQLAlchemy のfunc
constructを使用して Python から同じことをしたいのですが、func
名前付きパラメーターを尊重していないようです:
In [85]: print(sqlalchemy.func.test_f('a', 'b'))
test_f(:test_f_1, :test_f_2)
In [86]: print(sqlalchemy.func.test_f('a'))
test_f(:test_f_1)
In [87]: print(sqlalchemy.func.test_f(a='a'))
test_f()
何か不足していますか、それともfunc
名前付きパラメーターをサポートしていませんか?