def METHOD_NAME(self, database):
    server = self.host
    if server == 'localhost':
        server = '127.0.0.1'  # localhost is not understood by pyodbc
    if self.port is not None:
        server += f',{self.port}'
    con_params = {
        'driver': '{ODBC Driver 17 for SQL Server}',
        'server': server,
        'database': database,
        'user': self.user,
        'password': self.password.get_secret_value() if self.password else None,
        'timeout': self.connect_timeout,
        'as_dict': True,
    }
    # remove None values
    return {k: v for k, v in con_params.items() if v is not None}