diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9602387 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +psycopg2-binary==2.9.3 +sqlalchemy==2.0.21 diff --git a/velho-oeste/main.py b/velho-oeste/main.py new file mode 100644 index 0000000..95b0033 --- /dev/null +++ b/velho-oeste/main.py @@ -0,0 +1,14 @@ +from sqlalchemy import create_engine + +def test_connection(): + try: + # Formato de URL de conexão do SQLAlchemy + engine = create_engine('postgresql://velho_oeste_user:vopassword@velho-oeste-postgres:5432/velho_oeste_db') + connection = engine.connect() + print("Conexão bem-sucedida ao banco de dados!") + connection.close() + except Exception as e: + print(f"Erro na conexão: {e}") + +if __name__ == "__main__": + test_connection()