From 5489f76b88b5498ea90d025eb20fd4769b916835 Mon Sep 17 00:00:00 2001 From: Tom Owers Date: Wed, 28 Aug 2024 11:10:26 +0100 Subject: [PATCH] fix(dev-ex): Move pymssql import (#24634) --- posthog/warehouse/models/external_data_schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posthog/warehouse/models/external_data_schema.py b/posthog/warehouse/models/external_data_schema.py index a4e91d45c577f..7659daab4a4e1 100644 --- a/posthog/warehouse/models/external_data_schema.py +++ b/posthog/warehouse/models/external_data_schema.py @@ -9,7 +9,6 @@ import uuid import psycopg2 import pymysql -import pymssql from .external_data_source import ExternalDataSource from posthog.warehouse.data_load.service import ( external_data_workflow_exists, @@ -358,6 +357,9 @@ def get_mssql_schemas( host: str, port: str, database: str, user: str, password: str, schema: str, ssh_tunnel: SSHTunnel ) -> dict[str, list[tuple[str, str]]]: def get_schemas(postgres_host: str, postgres_port: int): + # Importing pymssql requires mssql drivers to be installed locally + import pymssql + connection = pymssql.connect( server=postgres_host, port=str(postgres_port),