Syntax for Calling Functions with Multiple Arg Groups #13086
Unanswered
inviscid
asked this question in
Usage Questions
Replies: 2 comments
-
|
im not familiar with that syntax. can you describe further waht that is exactly? is that some kind of function that returns a function? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
an example of how to do this is from sqlalchemy import Double
from sqlalchemy.sql import select, func, column
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.functions import GenericFunction
class quantile_tdigiest(GenericFunction):
type = Double()
name = "QUANTILE_TDIGIEST"
inherit_cache = True
@compiles(quantile_tdigiest)
def default_quantile_tdigiest(element, compiler, **kw):
level, expr = list(element.clauses)
return f"{element.name}({compiler.process(level, **kw)})({compiler.process(expr, **kw)})"
stmt = select(func.quantile_tdigiest(12, column("value")))
print(stmt)that prints SELECT QUANTILE_TDIGIEST(:QUANTILE_TDIGIEST_2)(value) AS "QUANTILE_TDIGIEST_1"I'm looking at this doc for that function: https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletdigest |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to call SQL functions that have two function arg objects strung together. For example, I've been trying to get this QUANTILE_TDIGIEST method to run using SQLAlchemy but I can't find the right syntax:
I've tried several approaches but they either fail on the python side or database side.
Beta Was this translation helpful? Give feedback.
All reactions