[Python] Snowflake Python Worksheet - main handler with additional arguments

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    The goal is to develop and Deploy Snowpark code inside Python Worksheet code that could take user input.

    If we try to provide additional user-defined arguments we get:

    import snowflake.snowpark as snowpark

    def main(session: snowpark.Session, param):
    df = session.table('snowflake_sample_data.tpch_sf10.lineitem').limit(param)
    return df


    Handler has more arguments than expected. Function signature must have exactly one argument:

    def main(session: snowpark.Session):​

    If we try to Deploy the code to a stored procedure:

    [​IMG]

    [​IMG]


    Stored procedure my_proc could not be created. failed running query: Python function is defined with 2 arguments (including session), but stored procedure definition contains 0 arguments. Python function arguments are expected to be session and stored procedure defined arguments in function MY_PROC with handler main
    ​

    Continue reading...

Compartilhe esta Página