// [END print_results] private static void Main(string[] args) { BigquerySample sample = new BigquerySample(); string projectId = null; if (args.Length == 0) { Console.WriteLine(usage); } else { projectId = args[0]; // Create a new Bigquery client authorized via Application Default // Credentials. BigqueryService bigquery = sample.CreateAuthorizedClient(); IList <TableRow> rows = sample.ExecuteQuery( "SELECT TOP(corpus, 10) as title, COUNT(*) as unique_words " + "FROM [publicdata:samples.shakespeare]", bigquery, projectId); sample.PrintResults(rows); } Console.WriteLine("\nPress any key..."); Console.ReadKey(); }
// [END print_results] private static void Main(string[] args) { SamplesUtil.InvokeMain(() => { var sample = new BigquerySample(); sample.MainFunction(args); }); }
public void TestShakespeare() { var sample = new BigquerySample(); var bigquery = sample.CreateAuthorizedClient(); var rows = sample.ExecuteQuery( "SELECT TOP(corpus, 10) as title, COUNT(*) as unique_words " + "FROM [publicdata:samples.shakespeare]", bigquery, System.Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID")); // Make sure the results look like shakespeare. bool foundKingLear = false; bool foundHamlet = false; foreach (TableRow row in rows) { foreach (TableCell field in row.F) { foundKingLear = foundKingLear || "kinglear".Equals(field.V); foundHamlet = foundHamlet || "hamlet".Equals(field.V); } } Assert.IsTrue(foundHamlet); Assert.IsTrue(foundKingLear); }