feat: Add new gcloud commands, API clients, and third-party libraries across various services.

This commit is contained in:
2026-01-01 20:26:35 +01:00
parent 5e23cbece0
commit a19e592eb7
25221 changed files with 8324611 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
"""Manage Bq resources."""
from googlecloudsdk.calliope import base
from surface.bq import _init_extensions as extensions
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
@base.Autogenerated
class BqAlpha(extensions.BqAlpha):
"""Manage Bq resources."""
@base.ReleaseTracks(base.ReleaseTrack.BETA)
@base.Autogenerated
class BqBeta(extensions.BqBeta):
"""Manage Bq resources."""
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Autogenerated
class BqGa(extensions.BqGa):
"""Manage Bq resources."""

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
"""File to add optional custom code to extend __init__.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.UniverseCompatible
class BqAlpha(base.Group):
"""Interact with and manage resources in Google BigQuery."""
category = base.BIG_DATA_CATEGORY
detailed_help = {
"brief": "Interact with and manage resources in Google BigQuery",
"DESCRIPTION": """\
Interact with and manage resources in Google BigQuery.
""",
}
def Filter(self, context, args):
# TODO(b/190526493): Determine if command group works with project number
base.RequireProjectID(args)
del context, args
# Enable self signed jwt for alpha track
self.EnableSelfSignedJwtForTracks([base.ReleaseTrack.ALPHA])
@base.UniverseCompatible
class BqBeta(base.Group):
"""Optional no-auto-generated code for BETA."""
category = base.BIG_DATA_CATEGORY
@base.UniverseCompatible
class BqGa(base.Group):
"""Optional no-auto-generated code for GA."""
category = base.BIG_DATA_CATEGORY

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The command group for Google BigQuery Datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
@base.UniverseCompatible
class Datasets(base.Group):
"""Manage Google BigQuery datasets."""

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for managing Google BigQuery dataset configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Google BigQuery dataset configurations."""

View File

@@ -0,0 +1,38 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Google BigQuery dataset.
description: |
*{command}* exports the configuration for a Google BigQuery dataset.
Dataset configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
datasets within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for a dataset, run:
$ {command} my-dataset
To export the configuration for a dataset to a file, run:
$ {command} my-dataset --path=/path/to/dir/
To export the configuration for a dataset in Terraform
HCL format, run:
$ {command} my-dataset --resource-format=terraform
To export the configurations for all datasets within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Dataset to export the configuration for.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset

View File

@@ -0,0 +1,45 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Create a new BigQuery dataset.
description: Create a new BigQuery dataset.
examples: |
The following command creates a dataset with ID `my-dataset`
$ {command} my-dataset --description 'My New Dataset'
The following command creates a dataset with ID `my-other-dataset`, overwritting destination
if it exists:
$ {command} my-other-dataset --description 'My Other Dataset' --overwrite
request:
collection: bigquery.datasets
method: insert
modify_request_hooks:
- 'googlecloudsdk.command_lib.util.hooks.request_modifiers:SetFieldFromName:api_field=dataset.datasetReference.datasetId'
- googlecloudsdk.command_lib.bq.hooks:ProcessDatasetOverwrite
arguments:
resource:
help_text: |-
ID of the the dataset being created. The ID must contain only letters (a-z, A-Z),
numbers (0-9), or underscores ( _ ). The maximum length is 1,024 characters.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset
params:
- _REF_: googlecloudsdk.command_lib.bq.flags:dataset.description
- _REF_: googlecloudsdk.command_lib.bq.flags:permissions_file
- _REF_: googlecloudsdk.command_lib.bq.flags:overwrite

View File

@@ -0,0 +1,37 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Delete a BigQuery dataset.
description: Delete a BigQuery dataset.
examples: |
The following command deletes a dataset with ID `my-dataset`
$ {command} my-dataset
request:
collection: bigquery.datasets
arguments:
resource:
help_text: The BigQuery dataset you want to delete.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset
params:
- api_field: deleteContents
arg_name: remove-tables
required: false
help_text: |
Remove the dataset even if it contains one or more tables. Tables will be removed
before deleteing dataset.

View File

@@ -0,0 +1,29 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Describe a BigQuery dataset.
description: Describe a BigQuery dataset.
examples: |
The following command fetches details about a dataset with ID `my-dataset`
$ {command} my-dataset
request:
collection: bigquery.datasets
arguments:
resource:
help_text: The BigQuery dataset you want to describe.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset

View File

@@ -0,0 +1,42 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: List all BigQuery datasets in a project.
description: List all BigQuery datasets in a project.
examples: |
The following command list all datasets in current project (including hidden)
$ {command} --all
request:
collection: bigquery.datasets
arguments:
resource:
help_text: The BigQuery project you want to list datasets for.
spec: !REF googlecloudsdk.command_lib.bq.resources:project
params:
- api_field: all
arg_name: all
required: false
help_text: List even hidden datasets.
output:
format: |
table(
id,
location
)

View File

@@ -0,0 +1,35 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Update a BigQuery dataset.
description: Update a BigQuery dataset.
examples: |
The following command updates the description on a dataset with ID `my-dataset`
$ {command} my-dataset --description 'My New Dataset Description'
request:
collection: bigquery.datasets
method: patch
arguments:
resource:
help_text: The BigQuery dataset you want to update.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset
params:
- _REF_: googlecloudsdk.command_lib.bq.flags:permissions_file
- _REF_: googlecloudsdk.command_lib.bq.flags:dataset.description

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The command group for Google BigQuery Jobs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Jobs(base.Group):
"""Interact with and manage jobs in Google BigQuery."""

View File

@@ -0,0 +1,33 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Cancel a BigQuery job.
description: Cancel a BigQuery job.
examples: |
The following command cancels a job named `my-query-job` and returns the final
state of the job:
$ {command} my-query-job
request:
collection: bigquery.jobs
method: cancel
response:
result_attribute: job
arguments:
resource:
help_text: The BigQuery job to cancel.
spec: !REF googlecloudsdk.command_lib.bq.resources:job

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for managing Google BigQuery job configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Google BigQuery job configurations."""

View File

@@ -0,0 +1,38 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Google BigQuery job.
description: |
*{command}* exports the configuration for a Google BigQuery job.
Job configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
jobs within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for a job, run:
$ {command} my-job
To export the configuration for a job to a file, run:
$ {command} my-job --path=/path/to/dir/
To export the configuration for a job in Terraform
HCL format, run:
$ {command} my-job --resource-format=terraform
To export the configurations for all jobs within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Job to export the configuration for.
spec: !REF googlecloudsdk.command_lib.bq.resources:job

View File

@@ -0,0 +1,29 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Describe a BigQuery job.
description: Describe a BigQuery job.
examples: |
The following command displays details for job named `my-query-job`
$ {command} my-query-job
request:
collection: bigquery.jobs
arguments:
resource:
help_text: The BigQuery job to display details for.
spec: !REF googlecloudsdk.command_lib.bq.resources:job

View File

@@ -0,0 +1,53 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: List all BigQuery jobs in a project.
description: List all BigQuery jobs in a project.
examples: |
The following command list all jobs in current project (for all users)
$ {command} --show-all-users
request:
collection: bigquery.jobs
arguments:
resource:
help_text: The BigQuery project you want to list jobs for.
spec: !REF googlecloudsdk.command_lib.bq.resources:project
params:
- api_field: allUsers
arg_name: show-all-users
required: false
help_text: List jobs from all users.
- api_field: projection
arg_name: show-config
action: store_true
processor: googlecloudsdk.command_lib.bq.hooks:JobListProjectionProcessor
required: false
default: false
help_text: Include job configuration in listing. Default is False.
output:
format: |
table(
jobReference.jobId,
jobReference.projectId,
statistics.creationTime.date(unit=1000, tz_default=UTC),
statistics.endTime.date(unit=1000, tz_default=UTC),
jobReference.location,
configuration.jobType:optional:label=JOB_TYPE
)

View File

@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
"""Manage Migration Workflow resources."""
from googlecloudsdk.calliope import base
from surface.bq.migration_workflows import _init_extensions as extensions
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
@base.Autogenerated
class MigrationWorkflowsAlpha(extensions.MigrationWorkflowsAlpha):
"""Manage Migration Workflow resources."""
@base.ReleaseTracks(base.ReleaseTrack.BETA)
@base.Autogenerated
class MigrationWorkflowsBeta(extensions.MigrationWorkflowsBeta):
"""Manage Migration Workflow resources."""
@base.ReleaseTracks(base.ReleaseTrack.GA)
@base.Autogenerated
class MigrationWorkflowsGa(extensions.MigrationWorkflowsGa):
"""Manage Migration Workflow resources."""

View File

@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
"""File to add optional custom code to extend __init__.py."""
from googlecloudsdk.calliope import base
class MigrationWorkflowsAlpha(base.Group):
"""Optional no-auto-generated code for ALPHA."""
class MigrationWorkflowsBeta(base.Group):
"""Optional no-auto-generated code for BETA."""
class MigrationWorkflowsGa(base.Group):
"""Optional no-auto-generated code for GA."""

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- ALPHA
auto_generated: true
help_text:
brief: Delete migration workflows
description: Delete a migration workflow
examples: |-
To delete a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- BETA
auto_generated: true
help_text:
brief: Delete migration workflows
description: Delete a migration workflow
examples: |-
To delete a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- GA
auto_generated: true
help_text:
brief: Delete migration workflows
description: Delete a migration workflow
examples: |-
To delete a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- ALPHA
auto_generated: true
help_text:
brief: Describe migration workflows
description: Describe a migration workflow
examples: |-
To describe a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- BETA
auto_generated: true
help_text:
brief: Describe migration workflows
description: Describe a migration workflow
examples: |-
To describe a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- GA
auto_generated: true
help_text:
brief: Describe migration workflows
description: Describe a migration workflow
examples: |-
To describe a migration workflow `projects/123/locations/eu/workflows/1234`, run:
$ {command} projects/123/locations/eu/workflows/1234
arguments:
params:
- help_text: |-
The unique identifier for the migration workflow.
Example: `projects/123/locations/us/workflows/1234`
is_positional: true
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations_workflows
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- ALPHA
auto_generated: true
help_text:
brief: List migration workflows
description: List migration workflows
examples: |-
To list all migration workflows in location `EU`, run:
$ {command} --location=eu
arguments:
params:
- help_text: |-
The project and location of the migration workflows to list.
Example: `projects/123/locations/us`
is_positional: false
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows
response:
id_field: name
output:
format: |-
table(name,
displayName,
state,
createTime,
lastUpdateTime)

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- BETA
auto_generated: true
help_text:
brief: List migration workflows
description: List migration workflows
examples: |-
To list all migration workflows in location `EU`, run:
$ {command} --location=eu
arguments:
params:
- help_text: |-
The project and location of the migration workflows to list.
Example: `projects/123/locations/us`
is_positional: false
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows
response:
id_field: name
output:
format: |-
table(name,
displayName,
state,
createTime,
lastUpdateTime)

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
- GA
auto_generated: true
help_text:
brief: List migration workflows
description: List migration workflows
examples: |-
To list all migration workflows in location `EU`, run:
$ {command} --location=eu
arguments:
params:
- help_text: |-
The project and location of the migration workflows to list.
Example: `projects/123/locations/us`
is_positional: false
is_primary_resource: true
resource_spec: !REF googlecloudsdk.command_lib.bq.v2_resources:projects_locations
required: true
request:
api_version: v2
collection:
- bigquerymigration.projects.locations.workflows
response:
id_field: name
output:
format: |-
table(name,
displayName,
state,
createTime,
lastUpdateTime)

View File

@@ -0,0 +1,96 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Implements command to create a migration workflow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.bq import util as api_util
from googlecloudsdk.api_lib.util import waiter
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.bq import command_utils
from googlecloudsdk.core import properties
from googlecloudsdk.core import resources
@base.UniverseCompatible
@base.ReleaseTracks(
base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA, base.ReleaseTrack.GA
)
class Create(base.Command):
"""Create a migration workflow."""
detailed_help = {
'brief': 'create migration workflows',
'DESCRIPTION': 'Create a migration workflow',
'EXAMPLES': """\
To create a migration workflow in EU synchronously based on a config file, run:
$ {command} --location=EU --config-file=config_file.yaml --no-async
""",
}
@staticmethod
def Args(parser):
base.ASYNC_FLAG.AddToParser(parser)
parser.add_argument(
'--location',
help='Location of the migration workflow.',
required=True,
)
parser.add_argument(
'--config-file',
help='Path to the migration workflows config file.',
required=True,
)
def Run(self, args):
client = api_util.GetMigrationApiClient()
migration_service = client.projects_locations_workflows
request_type = api_util.GetMigrationApiMessage(
'BigquerymigrationProjectsLocationsWorkflowsCreateRequest'
)
request = request_type()
project = args.project or properties.VALUES.core.project.Get(required=True)
location = args.location
migration_workflow = command_utils.GetResourceFromFile(
args.config_file,
api_util.GetMigrationApiMessage(
'GoogleCloudBigqueryMigrationV2MigrationWorkflow'
),
)
request.parent = f'projects/{project}/locations/{location}'
request.googleCloudBigqueryMigrationV2MigrationWorkflow = migration_workflow
response = migration_service.Create(request)
if args.async_:
return response
else:
migration_workflow_ref = resources.REGISTRY.ParseRelativeName(
response.name,
collection='bigquerymigration.projects.locations.workflows',
)
poller = command_utils.BqMigrationWorkflowPoller(migration_service)
response = waiter.WaitFor(
poller=poller,
operation_ref=migration_workflow_ref,
message='Running migration workflow [{}]'.format(response.name),
)
return response

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
_PARTIALS_: true

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
_PARTIALS_: true

View File

@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
_PARTIALS_: true

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The command group for Google BigQuery Tables."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Tables(base.Group):
"""Interact with and manage Google BigQuery tables."""

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Command group for managing Google BigQuery table configurations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Config(base.Group):
"""Manage Google BigQuery table configurations."""

View File

@@ -0,0 +1,38 @@
release_tracks: [ALPHA]
command_type: CONFIG_EXPORT
help_text:
brief: Export the configuration for a Google BigQuery table.
description: |
*{command}* exports the configuration for a Google BigQuery table.
Table configurations can be exported in
Kubernetes Resource Model (krm) or Terraform HCL formats. The
default format is `krm`.
Specifying `--all` allows you to export the configurations for all
tables within the project.
Specifying `--path` allows you to export the configuration(s) to
a local directory.
examples: |
To export the configuration for a table, run:
$ {command} my-table
To export the configuration for a table to a file, run:
$ {command} my-table --path=/path/to/dir/
To export the configuration for a table in Terraform
HCL format, run:
$ {command} my-table --resource-format=terraform
To export the configurations for all tables within a
project, run:
$ {command} --all
arguments:
resource:
help_text: Table to export the configuration for.
spec: !REF googlecloudsdk.command_lib.bq.resources:table

View File

@@ -0,0 +1,104 @@
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""BQ copy command."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from googlecloudsdk.api_lib.bq import util as api_util
from googlecloudsdk.api_lib.util import waiter
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.bq import command_utils
from googlecloudsdk.command_lib.bq import hooks
from googlecloudsdk.command_lib.util.apis import arg_utils
from googlecloudsdk.core import log
from googlecloudsdk.core import properties
from googlecloudsdk.core import resources
@base.UniverseCompatible
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
class Copy(base.Command):
"""Bq Copy Command."""
detailed_help = {
'brief': 'Copy one BigQuery table to another.',
'DESCRIPTION': """\
*{command}* Copies one BigQuery table to another.
""",
'EXAMPLES': """\
The following copies table `my-table` to table `my-other-table`, in dataset `my-dataset`
overwriting destination if it exists:
$ {command} --source my-table --destination my-other-table --source-dataset my-dataset --overwrite
""",
}
@staticmethod
def Args(parser):
base.ASYNC_FLAG.AddToParser(parser)
base.Argument(
'--overwrite',
action='store_true',
default=False,
required=False,
help='Overwrite if the resource already exists.').AddToParser(parser)
base.Argument(
'--job-id',
required=False,
default='',
help='A unique job ID to use for the request. '
'If not specified a unique job id will '
'be generated.').AddToParser(parser)
concept_parser = command_utils.GetTableCopyResourceArgs()[0]
concept_parser.AddToParser(parser)
def Run(self, args):
job_id = hooks.JobIdProcessor(args.job_id)
requests_type = api_util.GetApiMessage('BigqueryJobsInsertRequest')
request = requests_type()
project = args.project or properties.VALUES.core.project.Get(required=True)
request.projectId = project
request = command_utils.ProcessTableCopyConfiguration(None, args, request)
request = command_utils.ProcessTableCopyOverwrite(None, args, request)
arg_utils.SetFieldInMessage(request, 'job.jobReference.jobId', job_id)
arg_utils.SetFieldInMessage(request, 'job.jobReference.projectId', project)
client = api_util.GetApiClient()
job_service = client.jobs
job = client.jobs.Insert(request)
source_ref = args.CONCEPTS.source.Parse()
destination_ref = args.CONCEPTS.destination.Parse()
copy_message = 'Copying {0}:{1} to {2}:{3}.'.format(
source_ref.Parent().Name(), source_ref.Name(),
destination_ref.Parent().Name(), destination_ref.Name())
if not args.async_:
log.CreatedResource(job.id, kind='Job', details=copy_message)
return job
result_service = client.tables
poller = command_utils.BqJobPoller(job_service, result_service)
job_ref = resources.REGISTRY.Parse(job.jobReference.jobId,
params={'projectId': project},
collection='bigquery.jobs')
result = waiter.WaitFor(poller=poller, operation_ref=job_ref,
message=copy_message)
log.status.Print('Copied {0}:{1} to {2}:{3}.'.format(
source_ref.Parent().Name(), source_ref.Name(),
destination_ref.Parent().Name(), destination_ref.Name()))
return result

View File

@@ -0,0 +1,120 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Create a new BigQuery table.
description: |-
Create a new BigQuery table.
Create a table or view with a specified name. A view is a collection of rows
selected by a query in a flag, and manipulated as a table. The dataset to contain
the table or view must already exist, and must not contain a table or view with
the specified name.
examples: |
The following command creates a table with ID `my-table` in `my-dataset`:
$ {command} /projects/myproject/datasets/my-dataset/tables/my-table --description 'My New Table'
The following command creates a view with ID `my-view` in dataset `my-other-dataset`:
$ {command} my-view --dataset my-other-dataset \
--view 'SELECT field1, field3 FROM `my-project.my-other-dataset.my-table`'
request:
collection: bigquery.tables
method: insert
modify_request_hooks:
- googlecloudsdk.command_lib.bq.hooks:ProcessTableOverwrite
- googlecloudsdk.command_lib.bq.hooks:SetViewParameters
- googlecloudsdk.command_lib.util.hooks.request_modifiers:SetFieldFromName:api_field=table.tableReference.tableId
arguments:
resource:
help_text: The BigQuery table you want to create.
spec: !REF googlecloudsdk.command_lib.bq.resources:table
params:
- _REF_: googlecloudsdk.command_lib.bq.flags:overwrite
- _REF_: googlecloudsdk.command_lib.bq.flags:table.description
- _REF_: googlecloudsdk.command_lib.bq.flags:table.expiration
- group:
mutex: true
required: false
help_text: Specify the table schema.
params:
- arg_name: schema
metavar: FIELD_NAME=FIELD_TYPE
api_field: table.schema.fields
type:
arg_dict:
flatten: true
spec:
- api_field: name
- api_field: type
help_text: |-
A comma-separated list of entries of the form FIELD_NAME[=FIELD_TYPE] specifying field names
and types for the table being created. FIELD_TYPE defaults to string if not present.
Possible FIELD_TYPES are `string`, `integer`, `float`, `boolean`, `record`, and `timestamp`.
For more details on BigQuery schemas see: https://cloud.google.com/bigquery/docs/schemas.
- arg_name: schema-file
api_field: table.schema
type: "googlecloudsdk.calliope.arg_parsers:FileContents:"
processor: googlecloudsdk.command_lib.bq.hooks:BqTableSchemaFileProcessor
help_text: |-
The name of a JSON file containing a single object containing an array each element
of which is an object with properties name, type, and, optionally a
mode (one of: `NULLABLE`, `REQUIRED` or `REPEATED`), specifying a schema for the table
being created. If mode is omitted the default is 'NULLABLE'.
For example:
{
'schema':
[
{
'name': 'field1',
'type': 'string',
'mode': 'REQUIRED'
},
{
'name': 'field2',
'type': 'integer',
'mode': 'REPEATED'
},
[
{
'name': 'fieldN',
'type': TYPE,
['mode': MODE]
}
...
]
]
}
For more details on BigQuery schemas see: https://cloud.google.com/bigquery/docs/schemas.
- group:
help_text: Create a view instead of regular table.
required: false
params:
- api_field: table.view.query
arg_name: view
required: true
help_text: |-
Create a view with this SQL query. (If this flag is not specified, a table is created.)
- api_field: table.view.useLegacySql
arg_name: use-legacy-sql
action: store_true
help_text: |-
If specified, query will use BigQuery's legacy SQL syntax. If not specified, query will use
BigQuery's standard SQL dialect by default (https://cloud.google.com/bigquery/sql-reference/).

View File

@@ -0,0 +1,29 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Delete a BigQuery table.
description: Delete a BigQuery table.
examples: |
The following command deletes a table with ID `my-table`
$ {command} my-table
request:
collection: bigquery.tables
arguments:
resource:
help_text: The BigQuery table you want to delete.
spec: !REF googlecloudsdk.command_lib.bq.resources:table

View File

@@ -0,0 +1,29 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Describe a BigQuery table.
description: Describe a BigQuery table.
examples: |
The following command fetches details about a table with ID `my-table`
$ {command} my-table
request:
collection: bigquery.tables
arguments:
resource:
help_text: The BigQuery table you want to describe.
spec: !REF googlecloudsdk.command_lib.bq.resources:table

View File

@@ -0,0 +1,50 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Insert records specified into an existing table.
description: |-
Insert records specified into an existing table.
examples: |
The following command inserts rows from `data_file.json` into `my-table` in `my-dataset`:
$ {command} --table /projects/myproject/datasets/my-dataset/tables/my-table --data data_file.json
request:
collection: bigquery.tabledata
method: insertAll
arguments:
resource:
help_text: The BigQuery table you want to insert data into.
override_resource_collection: true
spec: !REF googlecloudsdk.command_lib.bq.resources:table
params:
- arg_name: data
api_field: tableDataInsertAllRequest.rows
required: true
repeated: false
type: "googlecloudsdk.calliope.arg_parsers:FileContents:"
processor: googlecloudsdk.command_lib.bq.hooks:BqTableDataFileProcessor
help_text: |-
The file containing the newline-delimited array of JSON objects representing rows to insert.
* For example:
[
{"string_col": "value1", "bool_col": false},
{"string_col": "value2", "bool_col": true},
{"string_col": "value3", "bool_col": false},
{"string_col": "value4", "bool_col": true},
{"string_col": "value5", "bool_col": false},
]

View File

@@ -0,0 +1,39 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: List all BigQuery tables and views in a dataset.
description: List all BigQuery tables and views in a dataset.
examples: |
The following command list all tables the specified dataset
$ {command} --dataset my-dataset
request:
collection: bigquery.tables
arguments:
resource:
help_text: The BigQuery dataset you want to list datasets for.
spec: !REF googlecloudsdk.command_lib.bq.resources:dataset
output:
format: |
table(
tableReference.datasetId,
tableReference.tableId,
creationTime.date(unit=1000, tz_default=UTC),
expirationTime.date(unit=1000, tz_default=UTC),
type
)

View File

@@ -0,0 +1,43 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Display selected rows in a specified table or view.
description: |-
Display selected rows in a specified table or view.
examples: |
The following command displays 150 rows of `my-table` in `my-dataset` starting from row 10:
$ {command} --table /projects/myproject/datasets/my-dataset/tables/my-table --limit 150 --start 10
request:
collection: bigquery.tabledata
method: list
arguments:
resource:
help_text: The BigQuery table you want to fetch rows from.
override_resource_collection: true
spec: !REF googlecloudsdk.command_lib.bq.resources:table
params:
- arg_name: limit
api_field: maxResults
required: false
default: 100
help_text: How many rows to return in the result.
- arg_name: start
api_field: startIndex
required: false
default: 0
help_text: First row to return in the result.

View File

@@ -0,0 +1,110 @@
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- release_tracks: [ALPHA]
help_text:
brief: Update a new BigQuery table.
description: |-
Create a new BigQuery table.
Updates one or more attributes of a table or view.
examples: |
The following command updates the description on a table with ID `my-table` in `my-dataset`:
$ {command} /projects/myproject/datasets/my-dataset/tables/my-table --description 'My New Table'
The following command changes the schema mode from `REQUIRED` to `NULLABLE` on the `value`
and `tags` columns in a table with ID `my-other-table` in dataset `my-other-dataset`:
$ {command} my-other-table --dataset my-other-dataset \
--relax-columns name,tags
request:
collection: bigquery.tables
method: patch
modify_request_hooks:
- googlecloudsdk.command_lib.util.hooks.request_modifiers:SetFieldFromName:api_field=table.tableReference.tableId
- googlecloudsdk.command_lib.bq.hooks:ProcessSchemaUpdate
arguments:
resource:
help_text: The BigQuery table you want to update.
spec: !REF googlecloudsdk.command_lib.bq.resources:table
params:
- _REF_: googlecloudsdk.command_lib.bq.flags:table.description
- _REF_: googlecloudsdk.command_lib.bq.flags:table.expiration
- arg_name: relax-columns
required: false
metavar: FIELD_NAME
type: 'googlecloudsdk.calliope.arg_parsers:ArgList:'
help_text: |
A comma-separated list of field names in the current schema that should have their mode
changed from REQUIRED to NULLABLE.
For more details on updating and managing BigQuery schemas see:
https://cloud.google.com/bigquery/docs/managing-table-schemas
- group:
mutex: true
required: false
help_text: Specify changes to the table schema.
params:
- arg_name: add-columns
metavar: FIELD_NAME=FIELD_TYPE
api_field: table.schema.fields
type:
arg_dict:
flatten: true
spec:
- api_field: name
- api_field: type
help_text: |-
A comma-separated list of entries of the form FIELD_NAME[=FIELD_TYPE] specifying field names
and types for the columns being added to the table. FIELD_TYPE defaults to string if not present.
Possible FIELD_TYPES are `string`, `integer`, `float`, `boolean`, `record`, and `timestamp`.
For more details on BigQuery schemas see: https://cloud.google.com/bigquery/docs/schemas.
- arg_name: add-columns-file
api_field: table.schema
type: "googlecloudsdk.calliope.arg_parsers:FileContents:"
processor: googlecloudsdk.command_lib.bq.hooks:BqTableSchemaFileProcessor
help_text: |-
The name of a JSON file containing a single object containing an array each element
of which is an object with properties name, type, and, optionally a
mode (one of: `NULLABLE` or `REPEATED`), specifying the columns to be added
to the table. If mode is omitted the default is 'NULLABLE'.
For example:
{
'schema':
[
{
'name': 'field1',
'type': 'string',
'mode': 'REQUIRED'
},
{
'name': 'field2',
'type': 'integer',
'mode': 'REPEATED'
},
[
{
'name': 'fieldN',
'type': TYPE,
['mode': MODE]
}
...
]
]
}
For more details on BigQuery schemas see: https://cloud.google.com/bigquery/docs/schemas.