# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates # SPDX-License-Identifier: MIT import asyncio import os # Configure Windows event loop policy for PostgreSQL compatibility # On Windows, psycopg requires a selector-based event loop, not the default ProactorEventLoop # This must be set at the earliest possible point before any event loop is created if os.name == "nt": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())