首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用雪花的Python调用存储过程时未定义“EmptyArrowIterator”错误

使用雪花的Python调用存储过程时未定义“EmptyArrowIterator”错误
EN

Stack Overflow用户
提问于 2020-05-19 21:03:50
回答 1查看 91关注 0票数 0

问题:当我使用连接器调用雪花中的存储过程时,会引发一个异常,其内容是:“名称‘EmptyArrowIterator’未定义”。

我的目标:使用雪花的Python连接器调用存储过程并将返回值保存到变量。

我尝试过的: I followed the instructions in this Stack Exchange post but was not successful in resolving the error.

我的代码:

代码语言:javascript
复制
import pandas as pd
#my code is long...a dataframe called credentials is defined elsewhere in my code and is not shown below

def logging_sproc(credentials):
    try:
        #import snowflake module and binding method
        import snowflake.connector
        #necesary for passing python variables to statements; note this method is server side
        #so there is no concern about SQL injection attacks
        snowflake.connector.paramstyle='qmark'

        #etl logging variables
        etl_name = credentials.iloc[0]['etl_name']
        etl_guid = credentials.iloc[0]['etl_guid']
        etl_taskname = credentials.iloc[0]['etl_task_name']
        etl_record_count = credentials.iloc[0]['record_count']

        #snowflake variables
        snowflake_warehouse = credentials.iloc[0]['snowflake_warehouse']
        snowflake_account = credentials.iloc[0]['snowflake_account']
        snowflake_role = credentials.iloc[0]['snowflake_role']
        snowflake_username = credentials.iloc[0]['Username']
        snowflake_password = credentials.iloc[0]['Password']
        snowflake_connection = ''
        cs = ''#snowflake connection cursor
        call_logging_sproc = ''

        #call the logging stored procedure
        snowflake_connection = snowflake.connector.connect(
        user = snowflake_username,
        password = snowflake_password,
        account = snowflake_account,
        warehouse = snowflake_warehouse,
        role = snowflake_role)
        cs = snowflake_connection.cursor()
        call_logging_sproc = cs.execute("CALL EDW_DEV.LOGGING.LOGGING_SP(?,?,?,?)",(etl_name,etl_guid,etl_taskname,etl_record_count))
    except Exception as error:
        return error
    finally:
        snowflake_connection.close()
    return  call_logging_sproc

logging_sp = logging_sproc(credentials)

谢谢你的帮助!

EN

回答 1

Stack Overflow用户

发布于 2020-05-20 21:56:24

我添加了call_logging_sproc.fetchmany(1),错误就消失了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61900742

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档