Skip to content

Commit 0ce07f5

Browse files
fix: update snowflake debug info to use direct SQL commands
Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
1 parent 076a520 commit 0ce07f5

File tree

3 files changed

+317
-9
lines changed

3 files changed

+317
-9
lines changed

.github/workflows/python_pytest.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,13 @@ jobs:
164164
# Job-specific step(s):
165165
- name: Print Snowflake Test Environment Info
166166
if: ${{ !github.event.pull_request.head.repo.fork }}
167+
env:
168+
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
167169
run: |
168170
echo "=== Snowflake Test Environment ==="
169-
echo "Snowflake Account Info (non-sensitive):"
171+
echo "Running Snowflake commands to get environment info..."
170172
poetry run python -c "
171-
import airbyte as ab
173+
from airbyte._processors.sql.snowflake import SnowflakeConfig, SnowflakeSqlProcessor
172174
from airbyte.secrets import GoogleGSMSecretManager
173175

174176
try:
@@ -177,11 +179,11 @@ try:
177179
credentials_json=ab.get_secret('GCP_GSM_CREDENTIALS')
178180
)
179181
config = gsm.get_secret('AIRBYTE_LIB_SNOWFLAKE_CREDS').parse_json()
180-
print(f'Account: {config.get(\"account\", \"<not-set>\")}')
181-
print(f'Username: {config.get(\"username\", \"<not-set>\")}')
182-
print(f'Default DB: {config.get(\"database\", \"<not-set>\")}')
182+
snowflake_config = SnowflakeConfig(**config)
183+
processor = SnowflakeSqlProcessor(snowflake_config)
184+
processor._init_connection_settings(processor.connection)
183185
except Exception as e:
184-
print(f'Error getting Snowflake config: {str(e)}')"
186+
print(f'Error getting Snowflake info: {str(e)}')"
185187

186188
- name: Run Pytest
187189
timeout-minutes: 60

airbyte/_processors/sql/snowflake.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ def _init_connection_settings(self, connection: Connection) -> None:
232232
SELECT
233233
CURRENT_USER() as USERNAME,
234234
CURRENT_ACCOUNT() as ACCOUNT_NAME,
235-
CURRENT_DATABASE() as DATABASE_NAME;
235+
CURRENT_DATABASE() as DATABASE_NAME,
236+
CURRENT_SCHEMA() as SCHEMA_NAME,
237+
CURRENT_WAREHOUSE() as WAREHOUSE_NAME,
238+
CURRENT_ROLE() as ROLE_NAME;
236239
"""
237240
)
238241
)

0 commit comments

Comments
 (0)