pyarrow 飞行错误:关闭前无法完成写入

pyarrow flight error: Could not finish writing before closing

提问人:dom159 提问时间:10/28/2023 更新时间:10/28/2023 访问量:51

问:

我有这段代码,我用来在 Dremio 中使用 pyarrow flight 执行查询:

class DremioConnector:
    env: str
    auth_token: str

    def __init__(self, env: str,  auth_token: str):
        self.env = env
        self.auth_token = auth_token

    def get_dremio_client(self):
        dremio_url = get_url_from_template(DREMIO_URL, self.env)

        return FlightClient(f"grpc+tls://{dremio_url}:*****", tls_root_certs=get_cert(),
                            middleware=[DremioClientAuthMiddlewareFactory(), CookieMiddlewareFactory()], **{}, )

    def get_dremio_credentials(self):
       
        ...
        ...

        return username, password

    def __create_flight_call_options(self, username: str, password: str, client: FlightClient) -> FlightCallOptions:
        headers: list[Any] = []

        bearer_token = client.authenticate_basic_token(username, password, FlightCallOptions(headers=headers))
        headers.append(bearer_token)
        return FlightCallOptions(headers=headers)

    def run_query(self, query: str, username: str, password: str, client: FlightClient) -> FlightStreamReader:
        flight_desc = FlightDescriptor.for_command(query)
        flight_info = client.get_flight_info(flight_desc, self.__create_flight_call_options(username, password, client))
        reader = client.do_get(flight_info.endpoints[0].ticket, self.__create_flight_call_options(username, password, client))
        return reader


connector = DremioConnector('env', "auth_token")

dremio_client = connector.get_dremio_client()

最近我开始收到这个错误:E pyarrow._flight。FlightInternalError:在关闭之前无法完成写入

呼叫时

bearer_token = client.authenticate_basic_token(用户名、密码、FlightCallOptions(headers=headers))

有谁知道可能是什么问题?我不知道为什么这个错误开始弹出,因为它以前在工作。我在这里做错了什么吗?

蟒蛇 pyarrow dremio apache-arrow-flight

评论

0赞 0x26res 10/28/2023
您还能发布错误的完整回溯吗?

答: 暂无答案