private async static Task QueryDatasets() { var dataClient = new DatasetsClient(pbi); var datasets = await dataClient.List(); foreach (var dataset in datasets.value) { Console.WriteLine("{0}\t{1}", dataset.name, dataset.id); } Console.WriteLine("Create a data set?"); Dataset created; if (Console.ReadKey().KeyChar == 'Y') { created = await dataClient.Create<resourceMeasures>("resourceManager", true); } else { created = (await dataClient.List()).value.First(ds => ds.name == "resourceManager"); } var tables = await dataClient.ListTables(created.id); ListTables(tables); //var table = dataClient.GetTable(created.id, tables.value.First().name); //ListColumns(table.columns); var table = await dataClient.UpdateTableSchema<resourceMeasures2>(created.id, tables.value.First().name); }
private async static Task QueryDatasets() { var dataClient = new DatasetsClient(pbi); var datasets = await dataClient.List(); foreach (var dataset in datasets.value) { Console.WriteLine("{0}\t{1}", dataset.name, dataset.id); } Console.WriteLine("Create a data set?"); Dataset created; if (Console.ReadKey().KeyChar == 'Y') { created = await dataClient.Create <resourceMeasures>("resourceManager", true); } else { created = (await dataClient.List()).value.First(ds => ds.name == "resourceManager"); } var tables = await dataClient.ListTables(created.id); ListTables(tables); //var table = dataClient.GetTable(created.id, tables.value.First().name); //ListColumns(table.columns); var table = await dataClient.UpdateTableSchema <resourceMeasures2>(created.id, tables.value.First().name); }
private static string CreateBIDataset(DatasetsClient client, Group g) { var datasets = client.List(g.id).Result; if (datasets.value.All(t => t.name != PowerByTheHour)) { var result = client.Create(g.id, PowerByTheHour, false, /*typeof(Classes.FlightInfoTableEntry), typeof(Classes.PositionTableEntry), typeof(Classes.SensorTableEntry),*/ typeof(Classes.FlattenedFlightInfoTableEntry)).Result; return(result.id); } else { return(datasets.value.First(t => t.name == PowerByTheHour).id); } }
//Groups: The Create Dataset operation can also create a dataset in a group //POST https://api.PowerBI.com/v1.0/myorg/groups/{group_id}/datasets //Create Dataset operation: https://msdn.microsoft.com/en-US/library/mt203562(Azure.100).aspx static async Task CreateDataset(string groupId) { try { var datasetsClient = new DatasetsClient(pbi); Dataset ds = (await datasetsClient.List(groupId)).value.First(d => d.name == datasetName); if (ds == null) { //create a dataset using the schema from Product await datasetsClient.Create <Product>(groupId, datasetName, false); } else { Console.WriteLine("Dataset exists"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
//The Create Dataset operation creates a new Dataset from a JSON schema definition and returns the Dataset ID //and the properties of the dataset created. //POST https://api.powerbi.com/v1.0/myorg/datasets //Create Dataset operation: https://msdn.microsoft.com/en-US/library/mt203562(Azure.100).aspx static async Task CreateDataset() { //In a production application, use more specific exception handling. try { var datasetsClient = new DatasetsClient(pbi); Dataset ds = (await datasetsClient.List()).value.FirstOrDefault(d => d.name == datasetName); if (ds == null) { //create a dataset using the schema from Product await datasetsClient.Create <Product>(datasetName, false); } else { Console.WriteLine("Dataset exists"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
//Groups: The Create Dataset operation can also create a dataset in a group //POST https://api.PowerBI.com/v1.0/myorg/groups/{group_id}/datasets //Create Dataset operation: https://msdn.microsoft.com/en-US/library/mt203562(Azure.100).aspx static async Task CreateDataset(string groupId) { try { var datasetsClient = new DatasetsClient(pbi); Dataset ds = (await datasetsClient.List(groupId)).value.First(d => d.name == datasetName); if (ds == null) { //create a dataset using the schema from Product await datasetsClient.Create<Product>(groupId, datasetName, false); } else { Console.WriteLine("Dataset exists"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
//The Create Dataset operation creates a new Dataset from a JSON schema definition and returns the Dataset ID //and the properties of the dataset created. //POST https://api.powerbi.com/v1.0/myorg/datasets //Create Dataset operation: https://msdn.microsoft.com/en-US/library/mt203562(Azure.100).aspx static async Task CreateDataset() { //In a production application, use more specific exception handling. try { var datasetsClient = new DatasetsClient(pbi); Dataset ds = (await datasetsClient.List()).value.FirstOrDefault(d=>d.name == datasetName); if (ds == null) { //create a dataset using the schema from Product await datasetsClient.Create<Product>(datasetName, false); } else { Console.WriteLine("Dataset exists"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }