Initial commit: SIBU 2.0 MISSION
This commit is contained in:
20
backend/test_db_fix.py
Normal file
20
backend/test_db_fix.py
Normal file
@ -0,0 +1,20 @@
|
||||
from sqlmodel import Session, create_engine, text
|
||||
from app.core.config import settings
|
||||
|
||||
def test_conn():
|
||||
url = settings.database_url.replace("+asyncpg", "+psycopg2")
|
||||
# Try adding .supabase.co if it's missing the dot
|
||||
if "ggo08co8sokggcc040o800c4" in url and "supabase.co" not in url:
|
||||
url = url.replace("ggo08co8sokggcc040o800c4", "db.ggo08co8sokggcc040o800c4.supabase.co")
|
||||
|
||||
print(f"Testing URL: {url}")
|
||||
try:
|
||||
engine = create_engine(url)
|
||||
with Session(engine) as session:
|
||||
session.exec(text("SELECT 1"))
|
||||
print("Connection successful!")
|
||||
except Exception as e:
|
||||
print(f"Connection failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_conn()
|
||||
Reference in New Issue
Block a user