Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        private async static Task GenerateData()
        {
            var dataClient = new DatasetsClient(pbi);
            var created    = (await dataClient.List()).value.First(ds => ds.name == "resourceManager");
            var tables     = await dataClient.ListTables(created.id);

            var dataRows = new TableRows <resourceMeasures>();

            for (int i = 0; i < 1000; i++)
            {
                dataRows.rows.Add(new resourceMeasures()
                {
                    Id            = Guid.NewGuid().ToString("n"),
                    InServiceDate = DateTime.Now.AddYears(-4),
                    IsRunning     = true,
                    LastMeasure   = DateTime.Now,
                    Name          = "Engine" + i.ToString(),
                    RPM           = 6000,
                    Temperature   = 431.6
                });
            }
            await dataClient.ClearRows(created.id, tables.value.First().name);

            await dataClient.AddRows(created.id, tables.value.First().name, dataRows);

            while (true)
            {
                Console.Write(".");
                foreach (var row in dataRows.rows)
                {
                    row.RPM          = (int)(6000 * Math.Sin(Math.PI * (DateTime.Now.Second / 59D)));
                    row.Temperature += new Random((int)DateTime.Now.Ticks).Next(-5, 5);
                    row.LastMeasure  = DateTime.Now;
                    row.IsRunning    = row.RPM > 1;
                    Thread.Sleep(1);
                }

                await dataClient.AddRows(created.id, tables.value.First().name, dataRows);
            }
            await dataClient.ClearRows(created.id, tables.value.First().name);
        }
Пример #4
0
 //Groups: The Get Tables operation returns a JSON list of Tables for the specified Dataset in a Group.
 //GET https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/tables
 //Get Tables operation: https://msdn.microsoft.com/en-US/library/mt203556.aspx
 static async Task<Tables> GetTables(string groupId, string datasetId)
 {
     var client = new DatasetsClient(pbi);
     return await client.ListTables(groupId, datasetId);
 }
Пример #5
0
        private async static Task GenerateData()
        {
            var dataClient = new DatasetsClient(pbi);
            var created = (await dataClient.List()).value.First(ds => ds.name == "resourceManager");
            var tables = await dataClient.ListTables(created.id);

            var dataRows = new TableRows<resourceMeasures>();

            for (int i = 0; i < 1000; i++)
            {
                dataRows.rows.Add(new resourceMeasures()
                {
                    Id = Guid.NewGuid().ToString("n"),
                    InServiceDate = DateTime.Now.AddYears(-4),
                    IsRunning = true,
                    LastMeasure = DateTime.Now,
                    Name = "Engine" + i.ToString(),
                    RPM = 6000,
                    Temperature = 431.6
                });
            }
            await dataClient.ClearRows(created.id, tables.value.First().name);
            await dataClient.AddRows(created.id, tables.value.First().name, dataRows);
            while (true)
            {
                Console.Write(".");
                foreach (var row in dataRows.rows)
                {
                    row.RPM = (int)(6000 * Math.Sin(Math.PI * (DateTime.Now.Second / 59D)));
                    row.Temperature += new Random((int)DateTime.Now.Ticks).Next(-5, 5);
                    row.LastMeasure = DateTime.Now;
                    row.IsRunning = row.RPM > 1;
                    Thread.Sleep(1);
                }

                await dataClient.AddRows(created.id, tables.value.First().name, dataRows);
            }
            await dataClient.ClearRows(created.id, tables.value.First().name);
        }
Пример #6
0
        //Groups: The Get Tables operation returns a JSON list of Tables for the specified Dataset in a Group.
        //GET https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/tables
        //Get Tables operation: https://msdn.microsoft.com/en-US/library/mt203556.aspx
        static async Task <Tables> GetTables(string groupId, string datasetId)
        {
            var client = new DatasetsClient(pbi);

            return(await client.ListTables(groupId, datasetId));
        }