Esempio n. 1
0
        public QueryTest()
        {
            // auth json!
            var json = "";
            var projectId = "";

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))
            {
                var authToken = GoogleWebAuthorizationBroker.AuthorizeAsync(ms,
                    new[] { BigqueryService.Scope.Bigquery },
                    "user",
                    CancellationToken.None, new FileDataStore(@"LINQtoBigQuery"))
                    .Result;

                var service = new BigqueryService(new BaseClientService.Initializer
                {
                    ApplicationName = "LINQ to BigQuery",
                    HttpClientInitializer = authToken
                });

                var rowsParser = new DeserializerRowsParser();

                context = new BigQueryContext(rowsParser, service, projectId);
            }
        }
Esempio n. 2
0
        public QueryTest()
        {
            // auth json!
            var json      = "";
            var projectId = "";

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))
            {
                var authToken = GoogleWebAuthorizationBroker.AuthorizeAsync(ms,
                                                                            new[] { BigqueryService.Scope.Bigquery },
                                                                            "user",
                                                                            CancellationToken.None, new FileDataStore(@"LINQtoBigQuery"))
                                .Result;

                var service = new BigqueryService(new BaseClientService.Initializer
                {
                    ApplicationName       = "LINQ to BigQuery",
                    HttpClientInitializer = authToken
                });

                var rowsParser = new DeserializerRowsParser();

                context = new BigQueryContext(rowsParser, service, projectId);
            }
        }
Esempio n. 3
0
        public static BigQueryContext GetContext(string json, string user, string projectId)
        {
            BigQueryContext context;

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))
            {
                // Open Browser, Accept Auth
                var userCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(ms,
                    new[] { BigqueryService.Scope.Bigquery },
                    user,
                    CancellationToken.None, new FileDataStore(@"LINQ-to-BigQuery-for-" + projectId)) // localcache
                    .GetAwaiter().GetResult();

                var bigquery = new BigqueryService(new BaseClientService.Initializer
                {
                    ApplicationName = "LINQ to BigQuery",
                    HttpClientInitializer = userCredential
                });

                var rowsParser = new DeserializerRowsParser();

                context = new BigQueryContext(rowsParser, bigquery, projectId);
            }
            // Timeout or other options
            context.TimeoutMs = (long)TimeSpan.FromMinutes(3).TotalMilliseconds;
            return context;
        }
Esempio n. 4
0
        private static BigQueryContext GetContext(string json, string user, string projectId)
        {
            BigQueryContext context;

            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json)))
            {
                // Open Browser, Accept Auth
                var userCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(ms,
                                                                                 new[] { BigqueryService.Scope.Bigquery },
                                                                                 user,
                                                                                 CancellationToken.None, new FileDataStore(@"LINQ-to-BigQuery-for-" + projectId)) // localcache
                                     .Result;

                var bigquery = new BigqueryService(new BaseClientService.Initializer
                {
                    ApplicationName       = "LINQ to BigQuery",
                    HttpClientInitializer = userCredential
                });

                var rowsParser = new DeserializerRowsParser();

                context = new BigQueryContext(rowsParser, bigquery, projectId);
            }
            // Timeout or other options
            context.TimeoutMs = (long)TimeSpan.FromMinutes(1).TotalMilliseconds;
            return(context);
        }
Esempio n. 5
0
        public static BigQueryContext GetContext()
        {
            var projectId = ConfigurationManager.AppSettings["projectId"];

            var bigquery = GetService();
            var rowsParser = new DeserializerRowsParser();
            var context = new BigQueryContext(rowsParser, bigquery, projectId);
            context.TimeoutMs = (long)TimeSpan.FromMinutes(5).TotalMilliseconds;
            return context;
        }
Esempio n. 6
0
        public static BigQueryContext GetContext()
        {
            var projectId = ConfigurationManager.AppSettings["projectId"];

            var bigquery   = GetService();
            var rowsParser = new DeserializerRowsParser();
            var context    = new BigQueryContext(rowsParser, bigquery, projectId);

            context.TimeoutMs = (long)TimeSpan.FromMinutes(5).TotalMilliseconds;
            return(context);
        }