Initial commit: SIBU 2.0 MISSION
This commit is contained in:
21
backend/get_remote_users_db.py
Normal file
21
backend/get_remote_users_db.py
Normal file
@ -0,0 +1,21 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user