Skip to content

Commit

Permalink
refactor: completely remove get_slice for snowflake translator
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Peschke <[email protected]>
  • Loading branch information
lukapeschke committed Apr 25, 2024
1 parent 0abbf58 commit ae6a7b7
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions toucan_connectors/snowflake/snowflake_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
from snowflake.connector.cursor import DictCursor as SfDictCursor

from toucan_connectors.common import ConnectorStatus
from toucan_connectors.pagination import build_pagination_info
from toucan_connectors.snowflake_common import (
build_database_model_extraction_query,
type_code_mapping,
)
from toucan_connectors.sql_query_helper import SqlQueryHelper
from toucan_connectors.toucan_connector import (
Category,
DataSlice,
DiscoverableConnector,
PlainJsonSecretStr,
TableInfo,
Expand Down Expand Up @@ -422,23 +420,9 @@ def _fetch_data(self, data_source: SnowflakeDataSource) -> pd.DataFrame:
)

def _retrieve_data(self, data_source: SnowflakeDataSource) -> pd.DataFrame:
return self._fetch_data(data_source)

def get_slice(
self,
data_source: SnowflakeDataSource,
permissions: dict | None = None,
offset: int = 0,
limit: int | None = None,
get_row_count: bool | None = False,
) -> DataSlice:
# We assume permissions have been applied earlier and that OFFSET and LIMIT have been
# applied by the PyPika translator
df = self._fetch_data(data_source)
return DataSlice(
df=df,
pagination_info=build_pagination_info(offset=0, limit=limit, total_rows=None, retrieved_rows=len(df)),
)
return self._fetch_data(data_source)

def describe(self, data_source: SnowflakeDataSource) -> dict[str, str]:
return self._describe_query(data_source.query)
Expand Down

0 comments on commit ae6a7b7

Please sign in to comment.