Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I Propose Additional Content for 'Creating PBIX File from XMLA Endpoint' ? #88

Closed
MicahDail opened this issue Feb 29, 2024 · 3 comments
Assignees

Comments

@MicahDail
Copy link

MicahDail commented Feb 29, 2024

Probably the most common blocker for this process would be if the XMLA endpoint has already processed the incremental refresh policy and created the numerous partitions. PBID will not allow you to open and rehydrate a file with policy based partitions (or any tables with more than one partition).

So we need to remove the policy based partitions, and create a new M partition with the incremental refresh expression. Here's a script that I am using to do this, and it looks like it's allowing me to proceed with the rehydration.

foreach (var t in Model.Tables)
{
    if(t.EnableRefreshPolicy)
 {
    //We will collect the SourceExpression from the Incremental Refresh Source Expression of the table
    string m_expression = t.SourceExpression.ToString();
     
    //We will generate a new partition name
    string partition_name = t.Name + "-" + Guid.NewGuid();

    //Now we will create a new partition
    t.AddMPartition(partition_name, m_expression);
    
    //Next we will delete all the incremental refresh partitions of the table
    foreach (var p in t.Partitions.Where(p => p.Name != partition_name).ToList())
    {
        p.Delete();
    }

    //Next we will set this M partition to Import mode
    foreach (var p in t.Partitions.Where(p => p.SourceType.ToString() == "M").ToList())
    {
        p.Mode = 0;
    }
     
}
};

Anyway someone better than me can improve that code and get that added into the documentation to help assist?

@MicahDail
Copy link
Author

Sorry about the formatting above with the blue code block only catching some of the code. I can't help that.

@mlonsk
Copy link
Collaborator

mlonsk commented Mar 19, 2024

Hi @MicahDail
Thank you for the suggestion, we will take a look at how we can improve the doc to include this.

@mlonsk mlonsk self-assigned this Apr 4, 2024
@mlonsk
Copy link
Collaborator

mlonsk commented Apr 4, 2024

Hi @MicahDail

I have added your script in a new (pull request)[https://github.com//pull/90] and once it has been reviewed we will have it included in the docs.
Thank you for taking the time to create the script and suggesting it to be included.

@mlonsk mlonsk closed this as completed Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants