File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ def __init__(self, config: Optional[DatabaseConfig] = None):
9292
9393 def _initialize_pool (self ) -> None :
9494 """Initialize connection pool."""
95+ if not PSYCOPG2_AVAILABLE :
96+ print ("[NeonDB] psycopg2 not available, skipping pool initialization" )
97+ return
98+
9599 try :
96100 self ._connection_pool = pool .SimpleConnectionPool (
97101 minconn = self .config .pool_min ,
@@ -244,6 +248,14 @@ def get_database() -> NeonDatabase:
244248 """
245249 global _db_instance
246250 if _db_instance is None :
251+ if not PSYCOPG2_AVAILABLE :
252+ print ("[NeonDB] psycopg2 not available (install with: pip install psycopg2-binary)" )
253+ # Create a disabled instance
254+ _db_instance = NeonDatabase .__new__ (NeonDatabase )
255+ _db_instance .config = DatabaseConfig ()
256+ _db_instance ._connection_pool = None
257+ return _db_instance
258+
247259 config = DatabaseConfig ()
248260 if config .is_configured :
249261 _db_instance = NeonDatabase (config )
You can’t perform that action at this time.
0 commit comments