from sqlmodel import Session, select, create_engine from app.models.user import User def get_remote_users(): # Trying the IP of api.sibu.vertexdc.com url = "postgresql+psycopg2://sibu:xajqcG2nYUoLXCBQYYYN7U23AZp2JWZNmDwo9ivrp6RnwcUcANPfhVXy2AM7J0sm@74.208.39.48:5432/sibu" print(f"Attempting to connect to: {url}") try: engine = create_engine(url, connect_args={'connect_timeout': 5}) with Session(engine) as session: print("Connection successful! Fetching users...") statement = select(User) users = session.exec(statement).all() print(f"Found {len(users)} users:") for u in users: print(f"- {u.full_name} ({u.email}) [Role: {u.role}]") except Exception as e: print(f"Connection failed: {e}") if __name__ == "__main__": get_remote_users()