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

            var pageManager = new TableRowPageManager(schema);

            return(new RestPagedEnumerable <TabledataResource.ListRequest, TableDataList, BigQueryRow>(
                       () => CreateListRequest(tableReference, options), pageManager));
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override PagedAsyncEnumerable <TableDataList, BigQueryRow> ListRowsAsync(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            // TODO: This is a synchronous call. We can't easily make this part asynchronous - we don't have a cancellation token, and we're returning
            // a non-task value. We could defer until the first MoveNext call, but that's tricky.
            schema = schema ?? GetSchema(tableReference);

            var pageManager = new TableRowPageManager(schema);

            return(new RestPagedAsyncEnumerable <TabledataResource.ListRequest, TableDataList, BigQueryRow>(
                       () => CreateListRequest(tableReference, options), pageManager));
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override PagedEnumerable <TableDataList, BigQueryRow> ListRows(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            // There's no way to specify fetching rows with no fields (that looks more like a dry run anyways).
            // So, if the schema is empty, the whole rows will be fetch, so we need to get the whole schema.
            var resultSchema = schema?.Fields?.Count > 0 ? schema : GetSchema(tableReference);

            var pageManager = new TableRowPageManager(resultSchema);

            return(new RestPagedEnumerable <TabledataResource.ListRequest, TableDataList, BigQueryRow>(
                       // Pass the original schema, if it was null then the whole table will be fetch and we don't need to
                       // specify selected fields.
                       () => CreateListRequest(tableReference, options, schema), pageManager));
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public override PagedAsyncEnumerable <TableDataList, BigQueryRow> ListRowsAsync(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            // TODO: This is a synchronous call. We can't easily make this part asynchronous - we don't have a cancellation token, and we're returning
            // a non-task value. We could defer until the first MoveNext call, but that's tricky.
            // There's no way to specify fetching rows with no fields (that looks more like a dry run anyways).
            // So, if the schema is empty, the whole rows will be fetch, so we need to get the whole schema.
            var resultSchema = schema?.Fields?.Count > 0 ? schema : GetSchema(tableReference);

            var pageManager = new TableRowPageManager(resultSchema);

            return(new RestPagedAsyncEnumerable <TabledataResource.ListRequest, TableDataList, BigQueryRow>(
                       // Pass the original schema, if it was null then the whole table will be fetch and we don't need to
                       // specify selected fields.
                       () => CreateListRequest(tableReference, options, schema), pageManager));
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override PagedAsyncEnumerable <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 RestPagedAsyncEnumerable <TabledataResource.ListRequest, TableDataList, BigQueryRow>(
                       requestProvider,
                       pageManager));
        }