def METHOD_NAME(txn: LoggingTransaction) -> List[Dict[str, Any]]:
    clauses: List[str] = []
    args: List[Any] = []
    if resource_id:
        clauses.append("resource_id = ?")
        args.append(resource_id)
    if actions is not None:
        clause, temp_args = make_in_list_sql_clause(
            txn.database_engine, "action", actions
        )
        clauses.append(clause)
        args.extend(temp_args)
    if statuses is not None:
        clause, temp_args = make_in_list_sql_clause(
            txn.database_engine, "status", statuses
        )
        clauses.append(clause)
        args.extend(temp_args)
    if max_timestamp is not None:
        clauses.append("timestamp <= ?")
        args.append(max_timestamp)
    sql = "SELECT * FROM scheduled_tasks"
    if clauses:
        sql = sql + " WHERE " + " AND ".join(clauses)
    sql = sql + " ORDER BY timestamp"
    txn.execute(sql, args)
    return self.db_pool.cursor_to_dict(txn)