delowan.googlecloud.gcp_bigquery_table (1.0.2) — module

Creates a GCP Table

Authors: Google Inc. (@googlecloudplatform)

preview | supported by community

Install collection

Install with ansible-galaxy collection install delowan.googlecloud:==1.0.2


Add to requirements.yml

  collections:
    - name: delowan.googlecloud
      version: 1.0.2

Description

A Table that belongs to a Dataset .


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a dataset
  google.cloud.gcp_bigquery_dataset:
    name: example_dataset
    dataset_reference:
      dataset_id: example_dataset
    project: "{{ gcp_project }}"
    auth_kind: "{{ gcp_cred_kind }}"
    service_account_file: "{{ gcp_cred_file }}"
    state: present
  register: dataset
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a table
  google.cloud.gcp_bigquery_table:
    name: example_table
    dataset: example_dataset
    table_reference:
      dataset_id: example_dataset
      project_id: test_project
      table_id: example_table
    project: test_project
    auth_kind: serviceaccount
    service_account_file: "/tmp/auth.pem"
    state: present

Inputs

    
name:
    description:
    - Name of the table.
    required: false
    type: str

view:
    description:
    - The view definition.
    required: false
    suboptions:
      use_legacy_sql:
        description:
        - Specifies whether to use BigQuery's legacy SQL for this view .
        required: false
        type: bool
      user_defined_function_resources:
        description:
        - Describes user-defined function resources used in the query.
        elements: dict
        required: false
        suboptions:
          inline_code:
            description:
            - An inline resource that contains code for a user-defined function (UDF).
              Providing a inline code resource is equivalent to providing a URI for a
              file containing the same code.
            required: false
            type: str
          resource_uri:
            description:
            - A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
            required: false
            type: str
        type: list
    type: dict

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether the given object should exist in GCP
    type: str

labels:
    description:
    - The labels associated with this dataset. You can use these to organize and group
      your datasets .
    required: false
    type: dict

schema:
    description:
    - Describes the schema of this table.
    required: false
    suboptions:
      fields:
        description:
        - Describes the fields in a table.
        elements: dict
        required: false
        suboptions:
          description:
            description:
            - The field description. The maximum length is 1,024 characters.
            required: false
            type: str
          fields:
            description:
            - Describes the nested schema fields if the type property is set to RECORD.
            elements: str
            required: false
            type: list
          mode:
            description:
            - The field mode.
            - 'Some valid choices include: "NULLABLE", "REQUIRED", "REPEATED"'
            required: false
            type: str
          name:
            description:
            - The field name.
            required: false
            type: str
          type:
            description:
            - The field data type.
            - 'Some valid choices include: "STRING", "BYTES", "INTEGER", "FLOAT", "TIMESTAMP",
              "DATE", "TIME", "DATETIME", "RECORD"'
            required: false
            type: str
        type: list
    type: dict

scopes:
    description:
    - Array of scopes to be used
    elements: str
    type: list

dataset:
    description:
    - Name of the dataset.
    required: false
    type: str

project:
    description:
    - The Google Cloud Platform project to use.
    type: str

env_type:
    description:
    - Specifies which Ansible environment you're running this module within.
    - This should not be set unless you know what you're doing.
    - This only alters the User Agent string for any API requests.
    type: str

num_rows:
    description:
    - The number of rows of data in this table, excluding any data in the streaming buffer.
    required: false
    type: int

auth_kind:
    choices:
    - application
    - machineaccount
    - serviceaccount
    description:
    - The type of credential used.
    required: true
    type: str

clustering:
    description:
    - One or more fields on which data should be clustered. Only top-level, non-repeated,
      simple-type fields are supported. When you cluster a table using multiple columns,
      the order of columns you specify is important. The order of the specified columns
      determines the sort order of the data.
    elements: str
    required: false
    type: list

description:
    description:
    - A user-friendly description of the dataset.
    required: false
    type: str

friendly_name:
    description:
    - A descriptive name for this table.
    required: false
    type: str

expiration_time:
    description:
    - The time when this table expires, in milliseconds since the epoch. If not present,
      the table will persist indefinitely.
    required: false
    type: int

table_reference:
    description:
    - Reference describing the ID of this table.
    required: false
    suboptions:
      dataset_id:
        description:
        - The ID of the dataset containing this table.
        required: false
        type: str
      project_id:
        description:
        - The ID of the project containing this table.
        required: false
        type: str
      table_id:
        description:
        - The ID of the the table.
        required: false
        type: str
    type: dict

time_partitioning:
    description:
    - If specified, configures time-based partitioning for this table.
    required: false
    suboptions:
      expiration_ms:
        description:
        - Number of milliseconds for which to keep the storage for a partition.
        required: false
        type: int
      field:
        description:
        - If not set, the table is partitioned by pseudo column, referenced via either
          '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field
          is specified, the table is instead partitioned by this field. The field must
          be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
        required: false
        type: str
      type:
        description:
        - The only type supported is DAY, which will generate one partition per day.
        - 'Some valid choices include: "DAY"'
        required: false
        type: str
    type: dict

service_account_file:
    description:
    - The path of a Service Account JSON file if serviceaccount is selected as type.
    type: path

service_account_email:
    description:
    - An optional service account email address if machineaccount is selected and the
      user does not wish to use the default email.
    type: str

encryption_configuration:
    description:
    - Custom encryption configuration.
    required: false
    suboptions:
      kms_key_name:
        description:
        - Describes the Cloud KMS encryption key that will be used to protect destination
          BigQuery table. The BigQuery Service Account associated with your project requires
          access to this encryption key.
        required: false
        type: str
    type: dict

service_account_contents:
    description:
    - The contents of a Service Account JSON file, either in a dictionary or as a JSON
      string that represents it.
    type: jsonarg

external_data_configuration:
    description:
    - 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.
    required: false
    suboptions:
      autodetect:
        description:
        - Try to detect schema and format options automatically. Any option specified
          explicitly will be honored.
        required: false
        type: bool
      bigtable_options:
        description:
        - Additional options if sourceFormat is set to BIGTABLE.
        required: false
        suboptions:
          column_families:
            description:
            - List of column families to expose in the table schema along with their types.
            elements: dict
            required: false
            suboptions:
              columns:
                description:
                - Lists of columns that should be exposed as individual fields as opposed
                  to a list of (column name, value) pairs.
                elements: dict
                required: false
                suboptions:
                  encoding:
                    description:
                    - The encoding of the values when the type is not STRING.
                    - 'Some valid choices include: "TEXT", "BINARY"'
                    required: false
                    type: str
                  field_name:
                    description:
                    - If the qualifier is not a valid BigQuery field identifier, a valid
                      identifier must be provided as the column field name and is used
                      as field name in queries.
                    required: false
                    type: str
                  only_read_latest:
                    description:
                    - If this is set, only the latest version of value in this column
                      are exposed .
                    required: false
                    type: bool
                  qualifier_string:
                    description:
                    - Qualifier of the column.
                    required: true
                    type: str
                  type:
                    description:
                    - The type to convert the value in cells of this column.
                    - 'Some valid choices include: "BYTES", "STRING", "INTEGER", "FLOAT",
                      "BOOLEAN"'
                    required: false
                    type: str
                type: list
              encoding:
                description:
                - The encoding of the values when the type is not STRING.
                - 'Some valid choices include: "TEXT", "BINARY"'
                required: false
                type: str
              family_id:
                description:
                - Identifier of the column family.
                required: false
                type: str
              only_read_latest:
                description:
                - If this is set only the latest version of value are exposed for all
                  columns in this column family .
                required: false
                type: bool
              type:
                description:
                - The type to convert the value in cells of this column family.
                - 'Some valid choices include: "BYTES", "STRING", "INTEGER", "FLOAT",
                  "BOOLEAN"'
                required: false
                type: str
            type: list
          ignore_unspecified_column_families:
            description:
            - If field is true, then the column families that are not specified in columnFamilies
              list are not exposed in the table schema .
            required: false
            type: bool
          read_rowkey_as_string:
            description:
            - If field is true, then the rowkey column families will be read and converted
              to string.
            required: false
            type: bool
        type: dict
      compression:
        description:
        - The compression type of the data source.
        - 'Some valid choices include: "GZIP", "NONE"'
        required: false
        type: str
      csv_options:
        description:
        - Additional properties to set if sourceFormat is set to CSV.
        required: false
        suboptions:
          allow_jagged_rows:
            description:
            - Indicates if BigQuery should accept rows that are missing trailing optional
              columns .
            required: false
            type: bool
          allow_quoted_newlines:
            description:
            - Indicates if BigQuery should allow quoted data sections that contain newline
              characters in a CSV file .
            required: false
            type: bool
          encoding:
            description:
            - The character encoding of the data.
            - 'Some valid choices include: "UTF-8", "ISO-8859-1"'
            required: false
            type: str
          field_delimiter:
            description:
            - The separator for fields in a CSV file.
            required: false
            type: str
          quote:
            description:
            - The value that is used to quote data sections in a CSV file.
            required: false
            type: str
          skip_leading_rows:
            description:
            - The number of rows at the top of a CSV file that BigQuery will skip when
              reading the data.
            required: false
            type: int
        type: dict
      google_sheets_options:
        description:
        - Additional options if sourceFormat is set to GOOGLE_SHEETS.
        required: false
        suboptions:
          skip_leading_rows:
            description:
            - The number of rows at the top of a Google Sheet that BigQuery will skip
              when reading the data.
            required: false
            type: int
        type: dict
      ignore_unknown_values:
        description:
        - Indicates if BigQuery should allow extra values that are not represented in
          the table schema .
        required: false
        type: bool
      max_bad_records:
        description:
        - The maximum number of bad records that BigQuery can ignore when reading data
          .
        required: false
        type: int
      schema:
        description:
        - The schema for the data. Schema is required for CSV and JSON formats.
        required: false
        suboptions:
          fields:
            description:
            - Describes the fields in a table.
            elements: dict
            required: false
            suboptions:
              description:
                description:
                - The field description.
                required: false
                type: str
              fields:
                description:
                - Describes the nested schema fields if the type property is set to RECORD
                  .
                elements: str
                required: false
                type: list
              mode:
                description:
                - Field mode.
                - 'Some valid choices include: "NULLABLE", "REQUIRED", "REPEATED"'
                required: false
                type: str
              name:
                description:
                - Field name.
                required: false
                type: str
              type:
                description:
                - Field data type.
                - 'Some valid choices include: "STRING", "BYTES", "INTEGER", "FLOAT",
                  "TIMESTAMP", "DATE", "TIME", "DATETIME", "RECORD"'
                required: false
                type: str
            type: list
        type: dict
      source_format:
        description:
        - The data format.
        - 'Some valid choices include: "CSV", "GOOGLE_SHEETS", "NEWLINE_DELIMITED_JSON",
          "AVRO", "DATASTORE_BACKUP", "BIGTABLE", "ORC"'
        required: false
        type: str
      source_uris:
        description:
        - The fully-qualified URIs that point to your data in Google Cloud.
        - 'For Google Cloud Storage URIs: Each URI can contain one ''*'' wildcard character
          and it must come after the ''bucket'' name. Size limits related to load jobs
          apply to external data sources. For Google Cloud Bigtable URIs: Exactly one
          URI can be specified and it has be a fully specified and valid HTTPS URL for
          a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one
          URI can be specified. Also, the ''*'' wildcard character is not allowed.'
        elements: str
        required: false
        type: list
    type: dict

Outputs

clustering:
  description:
  - One or more fields on which data should be clustered. Only top-level, non-repeated,
    simple-type fields are supported. When you cluster a table using multiple columns,
    the order of columns you specify is important. The order of the specified columns
    determines the sort order of the data.
  returned: success
  type: list
creationTime:
  description:
  - The time when this dataset was created, in milliseconds since the epoch.
  returned: success
  type: int
dataset:
  description:
  - Name of the dataset.
  returned: success
  type: str
description:
  description:
  - A user-friendly description of the dataset.
  returned: success
  type: str
encryptionConfiguration:
  contains:
    kmsKeyName:
      description:
      - Describes the Cloud KMS encryption key that will be used to protect destination
        BigQuery table. The BigQuery Service Account associated with your project
        requires access to this encryption key.
      returned: success
      type: str
  description:
  - Custom encryption configuration.
  returned: success
  type: complex
expirationTime:
  description:
  - The time when this table expires, in milliseconds since the epoch. If not present,
    the table will persist indefinitely.
  returned: success
  type: int
externalDataConfiguration:
  contains:
    autodetect:
      description:
      - Try to detect schema and format options automatically. Any option specified
        explicitly will be honored.
      returned: success
      type: bool
    bigtableOptions:
      contains:
        columnFamilies:
          contains:
            columns:
              contains:
                encoding:
                  description:
                  - The encoding of the values when the type is not STRING.
                  returned: success
                  type: str
                fieldName:
                  description:
                  - If the qualifier is not a valid BigQuery field identifier, a valid
                    identifier must be provided as the column field name and is used
                    as field name in queries.
                  returned: success
                  type: str
                onlyReadLatest:
                  description:
                  - If this is set, only the latest version of value in this column
                    are exposed .
                  returned: success
                  type: bool
                qualifierString:
                  description:
                  - Qualifier of the column.
                  returned: success
                  type: str
                type:
                  description:
                  - The type to convert the value in cells of this column.
                  returned: success
                  type: str
              description:
              - Lists of columns that should be exposed as individual fields as opposed
                to a list of (column name, value) pairs.
              returned: success
              type: complex
            encoding:
              description:
              - The encoding of the values when the type is not STRING.
              returned: success
              type: str
            familyId:
              description:
              - Identifier of the column family.
              returned: success
              type: str
            onlyReadLatest:
              description:
              - If this is set only the latest version of value are exposed for all
                columns in this column family .
              returned: success
              type: bool
            type:
              description:
              - The type to convert the value in cells of this column family.
              returned: success
              type: str
          description:
          - List of column families to expose in the table schema along with their
            types.
          returned: success
          type: complex
        ignoreUnspecifiedColumnFamilies:
          description:
          - If field is true, then the column families that are not specified in columnFamilies
            list are not exposed in the table schema .
          returned: success
          type: bool
        readRowkeyAsString:
          description:
          - If field is true, then the rowkey column families will be read and converted
            to string.
          returned: success
          type: bool
      description:
      - Additional options if sourceFormat is set to BIGTABLE.
      returned: success
      type: complex
    compression:
      description:
      - The compression type of the data source.
      returned: success
      type: str
    csvOptions:
      contains:
        allowJaggedRows:
          description:
          - Indicates if BigQuery should accept rows that are missing trailing optional
            columns .
          returned: success
          type: bool
        allowQuotedNewlines:
          description:
          - Indicates if BigQuery should allow quoted data sections that contain newline
            characters in a CSV file .
          returned: success
          type: bool
        encoding:
          description:
          - The character encoding of the data.
          returned: success
          type: str
        fieldDelimiter:
          description:
          - The separator for fields in a CSV file.
          returned: success
          type: str
        quote:
          description:
          - The value that is used to quote data sections in a CSV file.
          returned: success
          type: str
        skipLeadingRows:
          description:
          - The number of rows at the top of a CSV file that BigQuery will skip when
            reading the data.
          returned: success
          type: int
      description:
      - Additional properties to set if sourceFormat is set to CSV.
      returned: success
      type: complex
    googleSheetsOptions:
      contains:
        skipLeadingRows:
          description:
          - The number of rows at the top of a Google Sheet that BigQuery will skip
            when reading the data.
          returned: success
          type: int
      description:
      - Additional options if sourceFormat is set to GOOGLE_SHEETS.
      returned: success
      type: complex
    ignoreUnknownValues:
      description:
      - Indicates if BigQuery should allow extra values that are not represented in
        the table schema .
      returned: success
      type: bool
    maxBadRecords:
      description:
      - The maximum number of bad records that BigQuery can ignore when reading data
        .
      returned: success
      type: int
    schema:
      contains:
        fields:
          contains:
            description:
              description:
              - The field description.
              returned: success
              type: str
            fields:
              description:
              - Describes the nested schema fields if the type property is set to
                RECORD .
              returned: success
              type: list
            mode:
              description:
              - Field mode.
              returned: success
              type: str
            name:
              description:
              - Field name.
              returned: success
              type: str
            type:
              description:
              - Field data type.
              returned: success
              type: str
          description:
          - Describes the fields in a table.
          returned: success
          type: complex
      description:
      - The schema for the data. Schema is required for CSV and JSON formats.
      returned: success
      type: complex
    sourceFormat:
      description:
      - The data format.
      returned: success
      type: str
    sourceUris:
      description:
      - The fully-qualified URIs that point to your data in Google Cloud.
      - 'For Google Cloud Storage URIs: Each URI can contain one ''*'' wildcard character
        and it must come after the ''bucket'' name. Size limits related to load jobs
        apply to external data sources. For Google Cloud Bigtable URIs: Exactly one
        URI can be specified and it has be a fully specified and valid HTTPS URL for
        a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly
        one URI can be specified. Also, the ''*'' wildcard character is not allowed.'
      returned: success
      type: list
  description:
  - 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.
  returned: success
  type: complex
friendlyName:
  description:
  - A descriptive name for this table.
  returned: success
  type: str
id:
  description:
  - An opaque ID uniquely identifying the table.
  returned: success
  type: str
labels:
  description:
  - The labels associated with this dataset. You can use these to organize and group
    your datasets .
  returned: success
  type: dict
lastModifiedTime:
  description:
  - The time when this table was last modified, in milliseconds since the epoch.
  returned: success
  type: int
location:
  description:
  - The geographic location where the table resides. This value is inherited from
    the dataset.
  returned: success
  type: str
name:
  description:
  - Name of the table.
  returned: success
  type: str
numBytes:
  description:
  - The size of this table in bytes, excluding any data in the streaming buffer.
  returned: success
  type: int
numLongTermBytes:
  description:
  - The number of bytes in the table that are considered "long-term storage".
  returned: success
  type: int
numRows:
  description:
  - The number of rows of data in this table, excluding any data in the streaming
    buffer.
  returned: success
  type: int
requirePartitionFilter:
  description:
  - If set to true, queries over this table require a partition filter that can be
    used for partition elimination to be specified.
  returned: success
  type: bool
schema:
  contains:
    fields:
      contains:
        description:
          description:
          - The field description. The maximum length is 1,024 characters.
          returned: success
          type: str
        fields:
          description:
          - Describes the nested schema fields if the type property is set to RECORD.
          returned: success
          type: list
        mode:
          description:
          - The field mode.
          returned: success
          type: str
        name:
          description:
          - The field name.
          returned: success
          type: str
        type:
          description:
          - The field data type.
          returned: success
          type: str
      description:
      - Describes the fields in a table.
      returned: success
      type: complex
  description:
  - Describes the schema of this table.
  returned: success
  type: complex
streamingBuffer:
  contains:
    estimatedBytes:
      description:
      - A lower-bound estimate of the number of bytes currently in the streaming buffer.
      returned: success
      type: int
    estimatedRows:
      description:
      - A lower-bound estimate of the number of rows currently in the streaming buffer.
      returned: success
      type: int
    oldestEntryTime:
      description:
      - Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds
        since the epoch, if the streaming buffer is available.
      returned: success
      type: int
  description:
  - Contains information regarding this table's streaming buffer, if one is present.
    This field will be absent if the table is not being streamed to or if there is
    no data in the streaming buffer.
  returned: success
  type: complex
tableReference:
  contains:
    datasetId:
      description:
      - The ID of the dataset containing this table.
      returned: success
      type: str
    projectId:
      description:
      - The ID of the project containing this table.
      returned: success
      type: str
    tableId:
      description:
      - The ID of the the table.
      returned: success
      type: str
  description:
  - Reference describing the ID of this table.
  returned: success
  type: complex
timePartitioning:
  contains:
    expirationMs:
      description:
      - Number of milliseconds for which to keep the storage for a partition.
      returned: success
      type: int
    field:
      description:
      - If not set, the table is partitioned by pseudo column, referenced via either
        '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field
        is specified, the table is instead partitioned by this field. The field must
        be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
      returned: success
      type: str
    type:
      description:
      - The only type supported is DAY, which will generate one partition per day.
      returned: success
      type: str
  description:
  - If specified, configures time-based partitioning for this table.
  returned: success
  type: complex
type:
  description:
  - Describes the table type.
  returned: success
  type: str
view:
  contains:
    useLegacySql:
      description:
      - Specifies whether to use BigQuery's legacy SQL for this view .
      returned: success
      type: bool
    userDefinedFunctionResources:
      contains:
        inlineCode:
          description:
          - An inline resource that contains code for a user-defined function (UDF).
            Providing a inline code resource is equivalent to providing a URI for
            a file containing the same code.
          returned: success
          type: str
        resourceUri:
          description:
          - A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
          returned: success
          type: str
      description:
      - Describes user-defined function resources used in the query.
      returned: success
      type: complex
  description:
  - The view definition.
  returned: success
  type: complex