Table class
Creates a table resource in a dataset for Google BigQuery. For more information see the official documentation and API.
> Note: On newer versions of the provider, you must explicitly set deletion_protection=false
(and run pulumi update to write the field to state) in order to destroy an instance.
It is recommended to not set this field (or set it to true) until you're ready to destroy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.bigquery.Dataset("default", {
datasetId: "foo",
friendlyName: "test",
description: "This is a test description",
location: "EU",
defaultTableExpirationMs: 3600000,
labels: {
env: "default",
},
});
const defaultTable = new gcp.bigquery.Table("default", {
datasetId: _default.datasetId,
tableId: "bar",
timePartitioning: {
type: "DAY",
},
labels: {
env: "default",
},
schema: `[
{
\\"name\\": \\"permalink\\",
\\"type\\": \\"STRING\\",
\\"mode\\": \\"NULLABLE\\",
\\"description\\": \\"The Permalink\\"
},
{
\\"name\\": \\"state\\",
\\"type\\": \\"STRING\\",
\\"mode\\": \\"NULLABLE\\",
\\"description\\": \\"State where the head office is located\\"
}
]
`,
});
const sheet = new gcp.bigquery.Table("sheet", {
datasetId: _default.datasetId,
tableId: "sheet",
externalDataConfiguration: {
autodetect: true,
sourceFormat: "GOOGLE_SHEETS",
googleSheetsOptions: {
skipLeadingRows: 1,
},
sourceUris: ["https://docs.google.com/spreadsheets/d/123456789012345"],
},
});
import pulumi
import pulumi_gcp as gcp
default = gcp.bigquery.Dataset("default",
dataset_id="foo",
friendly_name="test",
description="This is a test description",
location="EU",
default_table_expiration_ms=3600000,
labels={
"env": "default",
})
default_table = gcp.bigquery.Table("default",
dataset_id=default.dataset_id,
table_id="bar",
time_partitioning={
"type": "DAY",
},
labels={
"env": "default",
},
schema="""[
{
\"name\": \"permalink\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"The Permalink\"
},
{
\"name\": \"state\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"State where the head office is located\"
}
]
""")
sheet = gcp.bigquery.Table("sheet",
dataset_id=default.dataset_id,
table_id="sheet",
external_data_configuration={
"autodetect": True,
"source_format": "GOOGLE_SHEETS",
"google_sheets_options": {
"skip_leading_rows": 1,
},
"source_uris": ["https://docs.google.com/spreadsheets/d/123456789012345"],
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.BigQuery.Dataset("default", new()
{
DatasetId = "foo",
FriendlyName = "test",
Description = "This is a test description",
Location = "EU",
DefaultTableExpirationMs = 3600000,
Labels =
{
{ "env", "default" },
},
});
var defaultTable = new Gcp.BigQuery.Table("default", new()
{
DatasetId = @default.DatasetId,
TableId = "bar",
TimePartitioning = new Gcp.BigQuery.Inputs.TableTimePartitioningArgs
{
Type = "DAY",
},
Labels =
{
{ "env", "default" },
},
Schema = @"[
{
\""name\"": \""permalink\"",
\""type\"": \""STRING\"",
\""mode\"": \""NULLABLE\"",
\""description\"": \""The Permalink\""
},
{
\""name\"": \""state\"",
\""type\"": \""STRING\"",
\""mode\"": \""NULLABLE\"",
\""description\"": \""State where the head office is located\""
}
]
",
});
var sheet = new Gcp.BigQuery.Table("sheet", new()
{
DatasetId = @default.DatasetId,
TableId = "sheet",
ExternalDataConfiguration = new Gcp.BigQuery.Inputs.TableExternalDataConfigurationArgs
{
Autodetect = true,
SourceFormat = "GOOGLE_SHEETS",
GoogleSheetsOptions = new Gcp.BigQuery.Inputs.TableExternalDataConfigurationGoogleSheetsOptionsArgs
{
SkipLeadingRows = 1,
},
SourceUris = new[]
{
"https://docs.google.com/spreadsheets/d/123456789012345",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigquery"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := bigquery.NewDataset(ctx, "default", &bigquery.DatasetArgs{
DatasetId: pulumi.String("foo"),
FriendlyName: pulumi.String("test"),
Description: pulumi.String("This is a test description"),
Location: pulumi.String("EU"),
DefaultTableExpirationMs: pulumi.Int(3600000),
Labels: pulumi.StringMap{
"env": pulumi.String("default"),
},
})
if err != nil {
return err
}
_, err = bigquery.NewTable(ctx, "default", &bigquery.TableArgs{
DatasetId: _default.DatasetId,
TableId: pulumi.String("bar"),
TimePartitioning: &bigquery.TableTimePartitioningArgs{
Type: pulumi.String("DAY"),
},
Labels: pulumi.StringMap{
"env": pulumi.String("default"),
},
Schema: pulumi.String(`[
{
\"name\": \"permalink\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"The Permalink\"
},
{
\"name\": \"state\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"State where the head office is located\"
}
]
`),
})
if err != nil {
return err
}
_, err = bigquery.NewTable(ctx, "sheet", &bigquery.TableArgs{
DatasetId: _default.DatasetId,
TableId: pulumi.String("sheet"),
ExternalDataConfiguration: &bigquery.TableExternalDataConfigurationArgs{
Autodetect: pulumi.Bool(true),
SourceFormat: pulumi.String("GOOGLE_SHEETS"),
GoogleSheetsOptions: &bigquery.TableExternalDataConfigurationGoogleSheetsOptionsArgs{
SkipLeadingRows: pulumi.Int(1),
},
SourceUris: pulumi.StringArray{
pulumi.String("https://docs.google.com/spreadsheets/d/123456789012345"),
},
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_bigquery_dataset" "default" {
dataset_id = "foo"
friendly_name = "test"
description = "This is a test description"
location = "EU"
default_table_expiration_ms = 3600000
labels = {
"env" = "default"
}
}
resource "gcp_bigquery_table" "default" {
dataset_id = gcp_bigquery_dataset.default.dataset_id
table_id = "bar"
time_partitioning = {
type = "DAY"
}
labels = {
"env" = "default"
}
schema = "[\n {\n \\\"name\\\": \\\"permalink\\\",\n \\\"type\\\": \\\"STRING\\\",\n \\\"mode\\\": \\\"NULLABLE\\\",\n \\\"description\\\": \\\"The Permalink\\\"\n },\n {\n \\\"name\\\": \\\"state\\\",\n \\\"type\\\": \\\"STRING\\\",\n \\\"mode\\\": \\\"NULLABLE\\\",\n \\\"description\\\": \\\"State where the head office is located\\\"\n }\n]\n"
}
resource "gcp_bigquery_table" "sheet" {
dataset_id = gcp_bigquery_dataset.default.dataset_id
table_id = "sheet"
external_data_configuration = {
autodetect = true
source_format = "GOOGLE_SHEETS"
google_sheets_options = {
skip_leading_rows = 1
}
source_uris = ["https://docs.google.com/spreadsheets/d/123456789012345"]
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigquery.Dataset;
import com.pulumi.gcp.bigquery.DatasetArgs;
import com.pulumi.gcp.bigquery.Table;
import com.pulumi.gcp.bigquery.TableArgs;
import com.pulumi.gcp.bigquery.inputs.TableTimePartitioningArgs;
import com.pulumi.gcp.bigquery.inputs.TableExternalDataConfigurationArgs;
import com.pulumi.gcp.bigquery.inputs.TableExternalDataConfigurationGoogleSheetsOptionsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new Dataset("default", DatasetArgs.builder()
.datasetId("foo")
.friendlyName("test")
.description("This is a test description")
.location("EU")
.defaultTableExpirationMs(3600000)
.labels(Map.of("env", "default"))
.build());
var defaultTable = new Table("defaultTable", TableArgs.builder()
.datasetId(default_.datasetId())
.tableId("bar")
.timePartitioning(TableTimePartitioningArgs.builder()
.type("DAY")
.build())
.labels(Map.of("env", "default"))
.schema("""
[
{
\"name\": \"permalink\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"The Permalink\"
},
{
\"name\": \"state\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"State where the head office is located\"
}
]
""")
.build());
var sheet = new Table("sheet", TableArgs.builder()
.datasetId(default_.datasetId())
.tableId("sheet")
.externalDataConfiguration(TableExternalDataConfigurationArgs.builder()
.autodetect(true)
.sourceFormat("GOOGLE_SHEETS")
.googleSheetsOptions(TableExternalDataConfigurationGoogleSheetsOptionsArgs.builder()
.skipLeadingRows(1)
.build())
.sourceUris("https://docs.google.com/spreadsheets/d/123456789012345")
.build())
.build());
}
}
resources:
default:
type: gcp:bigquery:Dataset
properties:
datasetId: foo
friendlyName: test
description: This is a test description
location: EU
defaultTableExpirationMs: 3.6e+06
labels:
env: default
defaultTable:
type: gcp:bigquery:Table
name: default
properties:
datasetId: ${default.datasetId}
tableId: bar
timePartitioning:
type: DAY
labels:
env: default
schema: |
[
{
\"name\": \"permalink\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"The Permalink\"
},
{
\"name\": \"state\",
\"type\": \"STRING\",
\"mode\": \"NULLABLE\",
\"description\": \"State where the head office is located\"
}
]
sheet:
type: gcp:bigquery:Table
properties:
datasetId: ${default.datasetId}
tableId: sheet
externalDataConfiguration:
autodetect: true
sourceFormat: GOOGLE_SHEETS
googleSheetsOptions:
skipLeadingRows: 1
sourceUris:
- https://docs.google.com/spreadsheets/d/123456789012345
Constructors
- Table(String name, {TableArgs? args, CustomResourceOptions? options})
-
Creates a new Table.
nameThe Pulumi resource name.argsArguments used to configure this Table. The set of arguments for Table.optionsResource options controlling this resource's behavior. - Table.reference(String urn)
- Creates a typed reference to an existing Table resource.
Properties
-
biglakeConfiguration
↔ Output<
TableBiglakeConfiguration?> -
Specifies the configuration of a BigLake managed table. Structure is documented below
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
clusterings
↔ Output<
List< String> ?> -
Specifies column names to use for data clustering.
Up to four top-level columns are allowed, and should be specified in
descending priority order.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
creationTime
↔ Output<
int> -
The time when this table was created, in milliseconds since the epoch.
latefinal
-
datasetId
↔ Output<
String> -
The dataset ID to create the table in.
Changing this forces a new resource to be created.
latefinal
-
deletionPolicy
↔ Output<
String> -
(Optional) Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE".
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
deletionProtection
↔ Output<
bool?> -
Whether or not to allow the provider to destroy the instance. Unless this field is set to false
in state, a
=destroyor=updatethat would delete the instance will fail.latefinal -
description
↔ Output<
String?> -
The field description.
latefinal
-
effectiveLabels
↔ Output<
Map< String, String> > -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
-
encryptionConfiguration
↔ Output<
TableEncryptionConfiguration?> -
Specifies how the table should be encrypted.
If left blank, the table will be encrypted with a Google-managed key; that process
is transparent to the user. Structure is documented below.
latefinal
-
etag
↔ Output<
String> -
A hash of the resource.
latefinal
-
expirationTime
↔ Output<
int> -
The time when this table expires, in
milliseconds since the epoch. If not present, the table will persist
indefinitely. Expired tables will be deleted and their storage
reclaimed.
latefinal
-
externalCatalogTableOptions
↔ Output<
TableExternalCatalogTableOptions?> -
Options defining open source
compatible table. Structure is documented below.
latefinal
-
externalDataConfiguration
↔ Output<
TableExternalDataConfiguration?> -
Describes the data format,
location, and other properties of a table stored outside of BigQuery.
By defining these properties, the data source can then be queried as
if it were a standard BigQuery table. Structure is documented below.
latefinal
-
friendlyName
↔ Output<
String?> -
A descriptive name for the table.
latefinal
-
generatedSchemaColumns
↔ Output<
String> -
(Output-only) A list of autogenerated schema fields.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
ignoreAutoGeneratedSchema
↔ Output<
bool?> -
If true, Terraform will prevent columns added by the server(e.g. hive partitioned columns) in schema from showing diff.
latefinal
-
ignoreSchemaChanges
↔ Output<
List< String> ?> -
A list of fields which would act non-authoritative for each column in schema.
NOTE: Right now only
dataPoliciesfield is supported(others might be supported in the future). It means that anydataPoliciesupdated outside terraform will be ignored if this option is used. If there is no policy in config for a column but there are in live state, the policy will persist. If the policy in config is updated, it will override the policy in the live state. Other fields likedescriptionfor a column will keep behaving as they are(authoritatively).latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
labels
↔ Output<
Map< String, String> ?> -
A mapping of labels to assign to the resource.
latefinal
-
lastModifiedTime
↔ Output<
int> -
The time when this table was last modified, in milliseconds since the epoch.
latefinal
-
location
↔ Output<
String> -
The geographic location where the table resides. This value is inherited from the dataset.
latefinal
-
materializedView
↔ Output<
TableMaterializedView?> -
If specified, configures this table as a materialized view.
Structure is documented below.
latefinal
-
maxStaleness
↔ Output<
String> -
The maximum staleness of data that could be
returned when the table (or stale MV) is queried. Staleness encoded as a
string encoding of SQL IntervalValue
type.
latefinal
-
numBytes
↔ Output<
int> -
The size of this table in bytes, excluding any data in the streaming buffer.
latefinal
-
numLongTermBytes
↔ Output<
int> -
The number of bytes in the table that are considered "long-term storage".
latefinal
-
numRows
↔ Output<
int> -
The number of rows of data in this table, excluding any data in the streaming buffer.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs. If it
is not provided, the provider project is used.
latefinal
-
pulumiLabels
↔ Output<
Map< String, String> > -
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
-
rangePartitioning
↔ Output<
TableRangePartitioning?> -
If specified, configures range-based
partitioning for this table. Structure is documented below.
latefinal
-
requirePartitionFilter
↔ Output<
bool?> -
If set to true, queries over this table
require a partition filter that can be used for partition elimination to be
specified.
latefinal
-
resourceTags
↔ Output<
Map< String, String> ?> -
The tags attached to this table. Tag keys are
globally unique. Tag key is expected to be in the namespaced format, for
example "123456789012/environment" where 123456789012 is the ID of the
parent organization or project resource for this tag key. Tag value is
expected to be the short name, for example "Production". See Tag definitions
for more details.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
schema
↔ Output<
String> -
A JSON schema for the table.
latefinal
-
schemaForeignTypeInfo
↔ Output<
TableSchemaForeignTypeInfo?> -
Specifies metadata of the foreign data
type definition in field schema. Structure is documented below.
latefinal
-
selfLink
↔ Output<
String> -
The URI of the created resource.
latefinal
-
tableConstraints
↔ Output<
TableTableConstraints?> -
Defines the primary key and foreign keys.
Structure is documented below.
latefinal
-
tableId
↔ Output<
String> -
A unique ID for the resource.
Changing this forces a new resource to be created.
latefinal
-
tableMetadataView
↔ Output<
String?> -
View sets the optional parameter "view": Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL
latefinal
-
tableReplicationInfo
↔ Output<
TableTableReplicationInfo?> -
Replication info of a table created
using "AS REPLICA" DDL like:
CREATE MATERIALIZED VIEW mv1 AS REPLICA OF srcMv. Structure is documented below.latefinal -
timePartitioning
↔ Output<
TableTimePartitioning?> -
If specified, configures time-based
partitioning for this table. Structure is documented below.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
type
↔ Output<
String> -
Describes the table type.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
-
view
↔ Output<
TableView?> -
If specified, configures this table as a view.
Structure is documented below.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited