Skip to content

Commit

Permalink
fix(snowflake): remove broken pyarrow fetch support
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 8, 2023
1 parent 74de349 commit c440adb
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import contextlib
import json
import warnings
from typing import TYPE_CHECKING, Any, Iterable
from typing import Any, Iterable

import sqlalchemy as sa
import toolz

import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import ibis.expr.schema as sch
from ibis.backends.base.sql.alchemy import (
AlchemyCompiler,
AlchemyExprTranslator,
Expand Down Expand Up @@ -56,9 +55,6 @@ def _handle_pyarrow_warning(*, action: str):
from ibis.backends.snowflake.datatypes import parse # noqa: E402
from ibis.backends.snowflake.registry import operation_registry # noqa: E402

if TYPE_CHECKING:
import pandas as pd


class SnowflakeExprTranslator(AlchemyExprTranslator):
_registry = operation_registry
Expand Down Expand Up @@ -209,18 +205,6 @@ def _get_sqla_table(
keep_existing=False,
)

def fetch_from_cursor(self, cursor, schema: sch.Schema) -> pd.DataFrame:
if not _NATIVE_ARROW:
return super().fetch_from_cursor(cursor, schema)

if (table := cursor.cursor.fetch_arrow_all()) is None:
import pandas as pd

df = pd.DataFrame(columns=schema.names)
else:
df = table.to_pandas(timestamp_as_object=True)
return schema.apply_to(df)

def _metadata(self, query: str) -> Iterable[tuple[str, dt.DataType]]:
with self.begin() as con, con.connection.cursor() as cur:
result = cur.describe(query)
Expand Down

0 comments on commit c440adb

Please sign in to comment.