import pyodbc

def get_connection():
    try:
        connection = pyodbc.connect(
            'DRIVER={ODBC Driver 17 for SQL Server};'
            'SERVER=localhost;'
            'DATABASE=SIPAH_DB;'
            'UID=sipah_user;'
            'PWD=12345;'
        )
        return connection
    except Exception as e:
        print("❌ Error al conectar con SQL Server:", e)
        return None
