/// <inheritdoc /> public override BigqueryTable GetTable(TableReference tableReference, GetTableOptions options = null) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); var request = Service.Tables.Get(tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId); options?.ModifyRequest(request); var resource = request.Execute(); return(new BigqueryTable(this, resource)); }
/// <inheritdoc /> public override async Task <BigqueryTable> GetOrCreateTableAsync(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); try { // TODO: Validate the schema matches? return(await GetTableAsync(tableReference, getOptions, cancellationToken).ConfigureAwait(false)); } catch (GoogleApiException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound) { return(await CreateTableAsync(tableReference, schema, createOptions, cancellationToken).ConfigureAwait(false)); } }
/// <summary> /// Retrieves a table. /// </summary> /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <returns>The requested table.</returns> public virtual BigqueryTable GetTable(TableReference tableReference, GetTableOptions options = null) { throw new NotImplementedException(); }
/// <summary> /// Retrieves a table within this client's project given the dataset ID and table ID. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="GetTable(TableReference,GetTableOptions)"/>. /// </summary> /// <param name="datasetId">The dataset ID. Must not be null.</param> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <returns>The requested table.</returns> public virtual BigqueryTable GetTable(string datasetId, string tableId, GetTableOptions options = null) => GetTable(GetTableReference(datasetId, tableId), options);
/// <summary> /// Attempts to fetch a table, creating it if it doesn't exist. /// </summary> /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the existing or new table.</returns> public virtual Task <BigqueryTable> GetOrCreateTableAsync(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }
/// <summary> /// Attempts to fetch the specified table within this client's project, creating it if it doesn't exist. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="GetOrCreateTableAsync(TableReference, TableSchema, GetTableOptions, CreateTableOptions,CancellationToken)"/>. /// </summary> /// <param name="datasetId">The dataset ID. Must not be null.</param> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the existing or new table.</returns> public virtual Task <BigqueryTable> GetOrCreateTableAsync(string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken)) => GetOrCreateTableAsync(GetTableReference(datasetId, tableId), schema, getOptions, createOptions, cancellationToken);
/// <summary> /// Retrieves a table. /// </summary> /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the requested table.</returns> public virtual Task <BigqueryTable> GetTableAsync(TableReference tableReference, GetTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException(); }
/// <summary> /// Retrieves a table within this client's project given the dataset ID and table ID. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="GetTableAsync(TableReference,GetTableOptions,CancellationToken)"/>. /// </summary> /// <param name="datasetId">The dataset ID. Must not be null.</param> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the requested table.</returns> public virtual Task <BigqueryTable> GetTableAsync(string datasetId, string tableId, GetTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) => GetTableAsync(GetTableReference(datasetId, tableId), options, cancellationToken);
/// <summary> /// Attempts to fetch a table, creating it if it doesn't exist. /// </summary> /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <returns>The existing or new table.</returns> public virtual BigqueryTable GetOrCreateTable(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null) { throw new NotImplementedException(); }
/// <summary> /// Attempts to fetch the specified table within this client's project, creating it if it doesn't exist. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="GetOrCreateTable(TableReference, TableSchema, GetTableOptions, CreateTableOptions)"/>. /// </summary> /// <param name="datasetId">The dataset ID. Must not be null.</param> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <returns>The existing or new table.</returns> public virtual BigqueryTable GetOrCreateTable(string datasetId, string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null) => GetOrCreateTable(GetTableReference(datasetId, tableId), schema, getOptions, createOptions);
/// <summary> /// Attempts to fetch the specified table within this dataset, creating it if it doesn't exist. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.GetOrCreateTableAsync(TableReference, TableSchema, GetTableOptions, CreateTableOptions, CancellationToken)"/>. /// </summary> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the existing or new table.</returns> public Task <BigqueryTable> GetOrCreateTableAsync(string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken)) => _client.GetOrCreateTableAsync(GetTableReference(tableId), schema, getOptions, createOptions, cancellationToken);
/// <summary> /// Asynchronously retrieves a table within this dataset. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.GetTableAsync(TableReference, GetTableOptions, CancellationToken)"/>. /// </summary> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A task representing the asynchronous operation. When complete, the result is /// the requested table.</returns> public Task <BigqueryTable> GetTableAsync(string tableId, GetTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) => _client.GetTableAsync(GetTableReference(tableId), options, cancellationToken);
/// <summary> /// Attempts to fetch the specified table within this dataset, creating it if it doesn't exist. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.GetOrCreateTable(TableReference, TableSchema, GetTableOptions, CreateTableOptions)"/>. /// </summary> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="schema">The schema to use to create the table if necessary. Must not be null.</param> /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param> /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param> /// <returns>The existing or new table.</returns> public BigqueryTable GetOrCreateTable(string tableId, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null) => _client.GetOrCreateTable(GetTableReference(tableId), schema, getOptions, createOptions);
/// <summary> /// Retrieves a table within this dataset. /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="BigqueryClient.GetTable(TableReference, GetTableOptions)"/>. /// </summary> /// <param name="tableId">The table ID. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param> /// <returns>The requested table.</returns> public BigqueryTable GetTable(string tableId, GetTableOptions options = null) => _client.GetTable(GetTableReference(tableId), options);
/// <inheritdoc /> public override BigqueryTable GetOrCreateTable(TableReference tableReference, TableSchema schema, GetTableOptions getOptions = null, CreateTableOptions createOptions = null) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); try { // TODO: Validate the schema matches? return(GetTable(tableReference, getOptions)); } catch (GoogleApiException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound) { return(CreateTable(tableReference, schema, createOptions)); } }
/// <inheritdoc /> public override async Task <BigqueryTable> GetTableAsync(TableReference tableReference, GetTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference)); var request = Service.Tables.Get(tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId); options?.ModifyRequest(request); var resource = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false); return(new BigqueryTable(this, resource)); }