snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-511739: Implement Cursor.callproc()

Open timgraham opened this issue 3 years ago • 0 comments

Since the initial public commit, Cursor.callproc() raises NotSupportedError: https://github.com/snowflakedb/snowflake-connector-python/blob/f963b1abfe7f365b7f84f5053def7ed70e5bd2a4/src/snowflake/connector/cursor.py#L367-L378 This could be implemented similar to mysqlclient's version. My quickly written and only briefly tested implementation (which may not correctly handle parameters) is:

def callproc(self, procname, args=()):
    processed_args = self._connection._process_params_pyformat(args, self)
    self.execute(
        'CALL %s(%s)' % (
            procname,
            ', '.join(x for x in processed_args),
        )
    )
    return args

See also PEP 249's documentation for Cursor.callproc().

timgraham avatar Nov 28 '21 00:11 timgraham