Exemplo n.º 1
0
        /// <inheritdoc />
        public override BigqueryResult ListRows(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
        {
            GaxRestPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            schema = schema ?? GetSchema(tableReference);

            Func <TabledataResource.ListRequest> requestProvider = () =>
            {
                var request = Service.Tabledata.List(tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);
                options?.ModifyRequest(request);
                return(request);
            };
            var firstResponse = requestProvider().Execute();

            return(new BigqueryResult(this, firstResponse, schema, requestProvider));
        }
        /// <inheritdoc />
        public override IPagedAsyncEnumerable <TableDataList, BigqueryRow> ListRowsAsync(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            schema = schema ?? GetSchema(tableReference);

            var pageManager = new TableRowPageManager(this, schema);

            Func <TabledataResource.ListRequest> requestProvider = () =>
            {
                var request = Service.Tabledata.List(tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);
                options?.ModifyRequest(request);
                return(request);
            };

            return(new PagedAsyncEnumerable <TabledataResource.ListRequest, TableDataList, BigqueryRow>(
                       requestProvider,
                       pageManager));
        }