Skip to content

Commit 8ce25f1

Browse files
authored
Fix snowflake loader stream state store (#30)
* snowflake loader: fix stream state store config, allow setting its own * logging: suppress acero alignment warnings
1 parent c8c0b0e commit 8ce25f1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/amp/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
"""Amp - Flight SQL client with comprehensive data loading capabilities."""
22

3+
import os
4+
5+
# Suppress PyArrow acero alignment warnings before any imports
6+
# These warnings are informational and cannot be controlled via logging
7+
# Valid values: ignore, warn, reallocate, error
8+
os.environ.setdefault('ACERO_ALIGNMENT_HANDLING', 'ignore')
9+
310
from amp.client import Client, QueryBuilder
411
from amp.registry import RegistryClient
512

src/amp/loaders/implementations/snowflake_loader.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,10 @@ def connect(self) -> None:
831831
self._create_stage()
832832

833833
# Replace in-memory state store with Snowflake-backed store if configured
834-
state_config = getattr(self.config, 'state', None)
835-
if state_config:
836-
storage = getattr(state_config, 'storage', None)
837-
enabled = getattr(state_config, 'enabled', True)
838-
if storage == 'snowflake' and enabled:
839-
self.logger.info('Using Snowflake-backed persistent state store')
840-
self.state_store = SnowflakeStreamStateStore(self.connection, self.cursor, self.logger)
834+
# Base class already parsed state config and stored it in self.state_storage and self.state_enabled
835+
if self.state_storage == 'snowflake' and self.state_enabled:
836+
self.logger.info('Using Snowflake-backed persistent state store')
837+
self.state_store = SnowflakeStreamStateStore(self.connection, self.cursor, self.logger)
841838
# Otherwise, state store is initialized in base class with in-memory storage (default)
842839

843840
self._is_connected = True

0 commit comments

Comments
 (0)