다음을 통해 공유


파티션 표현(테이블 형식)

연산을 위해 테이블을 서로 다른 행 하위 집합으로 나눌 수 있으며, 함께 결합하면 테이블이 형성됩니다. 이러한 각 하위 집합은 테이블의 파티션입니다.

파티션 표현

AMO 개체의 관점에서 파티션 표현은 1 대 1 매핑 관계를 Partition 가지며 다른 주요 AMO 개체는 필요하지 않습니다.

AMO의 파티션

AMO를 사용하여 파티션을 관리하는 경우 테이블 형식 모델 테이블을 나타내는 측정값 그룹을 찾고 여기에서 작업해야 합니다.

다음 코드 조각은 기존 테이블 형식 모델 테이블에 파티션을 추가하는 방법을 보여줍니다.

  
private void AddPartition(  
                     AMO.Cube modelCube  
                  ,  AMO.DataSource newDatasource  
                  ,  string mgName  
                  ,  string newPartitionName  
                  , string partitionSelectStatement  
                  , Boolean processPartition  
             )  
{  
    mgName = mgName.Trim();  
    newPartitionName = newPartitionName.Trim();  
    partitionSelectStatement = partitionSelectStatement.Trim();  
    //Validate Input  
    if (string.IsNullOrEmpty(newPartitionName) || string.IsNullOrWhiteSpace(newPartitionName))  
    {  
        MessageBox.Show(String.Format("Partition Name cannot be empty or blank"), "AMO to Tabular message", MessageBoxButtons.OK, MessageBoxIcon.Error);  
        return;  
    }  
  
    if (modelCube.MeasureGroups[mgName].Partitions.ContainsName(newPartitionName))  
    {  
        MessageBox.Show(String.Format("Partition Name already defined. Duplicated names are not allowed"), "AMO to Tabular message", MessageBoxButtons.OK, MessageBoxIcon.Error);  
        return;  
    }  
  
    if (string.IsNullOrEmpty(partitionSelectStatement) || string.IsNullOrWhiteSpace(partitionSelectStatement))  
    {  
        MessageBox.Show(String.Format("Select statement cannot be empty or blank"), "AMO to Tabular message", MessageBoxButtons.OK, MessageBoxIcon.Error);  
        return;  
    }  
  
    //Input validated  
    string partitionID = newPartitionName; //Using partition name as the ID  
    AMO.Partition currentPartition = new AMO.Partition(partitionID, partitionID);  
    currentPartition.StorageMode = AMO.StorageMode.InMemory;  
    currentPartition.ProcessingMode = AMO.ProcessingMode.Regular;  
    currentPartition.Source = new AMO.QueryBinding(newDatasource.ID, partitionSelectStatement);  
    modelCube.MeasureGroups[mgName].Partitions.Add(currentPartition);  
    try  
    {  
        modelCube.Update(AMO.UpdateOptions.ExpandFull, AMO.UpdateMode.UpdateOrCreate);  
        if (processPartition)  
        {  
            modelCube.MeasureGroups[mgName].Partitions[partitionID].Process(AMO.ProcessType.ProcessFull);  
            MessageBox.Show(String.Format("Partition successfully processed."), "AMO to Tabular message", MessageBoxButtons.OK, MessageBoxIcon.Information);  
        }  
  
    }  
    catch (AMO.AmoException amoXp)  
    {  
        MessageBox.Show(String.Format("AMO exception accessing the server.\nError message: {0}", amoXp.Message), "AMO to Tabular message", MessageBoxButtons.OK, MessageBoxIcon.Warning);  
        return;  
    }  
    catch (Exception)  
    {  
        throw;  
    }  
}  
  

AMO2Tabular 샘플

그러나 AMO를 사용하여 파티션 표현을 만들고 조작하는 방법을 이해하려면 AMO에서 테이블 형식으로의 소스 코드를 참조하세요. 샘플은 Codeplex에서 사용할 수 있습니다. 코드에 대한 중요한 참고 사항: 코드는 여기에 설명된 논리적 개념에 대한 지원으로만 제공되며 프로덕션 환경에서 사용하면 안 됩니다. 교육학 이외의 다른 용도로 사용해서는 안 됩니다.