Exemple #1
0
        // [START ExportTable]
        public static Job ExportTable(Options options)
        {
            var bigquery = CreateAuthorizedClient();
            var jobId    = Guid.NewGuid().ToString();
            var request  = new JobsResource.InsertRequest(bigquery, new Job
            {
                Configuration = new JobConfiguration
                {
                    Extract = new JobConfigurationExtract
                    {
                        SourceTable = new TableReference
                        {
                            ProjectId = options.ProjectId,
                            DatasetId = options.DatasetId,
                            TableId   = options.TableId,
                        },
                        DestinationUris   = new[] { options.CloudStoragePath },
                        DestinationFormat = options.ExportFormat,
                        Compression       = options.Compression
                    }
                },
                JobReference = new JobReference
                {
                    ProjectId = options.ProjectId,
                    JobId     = jobId,
                }
            }, options.ProjectId);

            return(request.Execute());
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            // TO UPDATE, can be found in the Coordinate application URL
            String TEAM_ID = "jskdQ--xKjFiFqLO-IpIlg";

            // Register the authenticator.
            var provider = new WebServerClient(GoogleAuthenticationServer.Description);

            // TO UPDATE, can be found in the APIs Console.
            provider.ClientIdentifier = "335858260352.apps.googleusercontent.com";
            // TO UPDATE, can be found in the APIs Console.
            provider.ClientSecret = "yAMx-sR[truncated]fX9ghtPRI";
            var auth = new OAuth2Authenticator <WebServerClient> (provider, GetAuthorization);

            // Create the service.
            var service = new CoordinateService(new BaseClientService.Initializer()
            {
                Authenticator = auth
            });

            //Create a Job Resource for optional parameters https://developers.google.com/coordinate/v1/jobs#resource
            Job jobBody = new Job();

            jobBody.Kind           = "Coordinate#job";
            jobBody.State          = new JobState();
            jobBody.State.Kind     = "coordinate#jobState";
            jobBody.State.Assignee = "*****@*****.**";


            //Create the Job
            JobsResource.InsertRequest ins = service.Jobs.Insert(jobBody, TEAM_ID, "My Home", "51", "0", "Created this Job with the .Net Client Library");
            Job results = ins.Fetch();

            //Display the response
            Console.WriteLine("Job ID:");
            Console.WriteLine(results.Id.ToString());
            Console.WriteLine("Press any Key to Continue");
            Console.ReadKey();
        }
 // [START ExportTable]
 public static Job ExportTable(Options options)
 {
     var bigquery = CreateAuthorizedClient();
     var jobId = Guid.NewGuid().ToString();
     var request = new JobsResource.InsertRequest(bigquery, new Job
     {
         Configuration = new JobConfiguration
         {
             Extract = new JobConfigurationExtract
             {
                 SourceTable = new TableReference
                 {
                     ProjectId = options.ProjectId,
                     DatasetId = options.DatasetId,
                     TableId = options.TableId,
                 },
                 DestinationUris = new[] { options.CloudStoragePath },
                 DestinationFormat = options.ExportFormat,
                 Compression = options.Compression
             }
         },
         JobReference = new JobReference
         {
             ProjectId = options.ProjectId,
             JobId = jobId,
         }
     }, options.ProjectId);
     return request.Execute();
 }