-
Notifications
You must be signed in to change notification settings - Fork 286
feat(bigquery): Add example for creating an authorized view #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
f077e22
69da499
1bcd207
85da7eb
6dba0df
509628f
48c2651
7d549c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,95 @@ | ||||||||||
| /** | ||||||||||
| * Copyright 2025 Google LLC | ||||||||||
| * | ||||||||||
| * 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. | ||||||||||
| */ | ||||||||||
|
|
||||||||||
|
|
||||||||||
| # [START bigquery_authorized_view_tutorial] | ||||||||||
| /* | ||||||||||
| Creates an authorized view. | ||||||||||
| */ | ||||||||||
|
|
||||||||||
|
|
||||||||||
| /* | ||||||||||
| Create a dataset to contain the authorized view. | ||||||||||
| */ | ||||||||||
|
||||||||||
| /* | |
| Create a dataset to contain the authorized view. | |
| */ | |
| # Create a dataset to contain the authorized view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in latest commit.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query: is the dataset "authdataset", or "movie_dataset"? You're assigning dataset access to a different dataset later int his sample.
You can reference google_bigquery_dataset.default.dataset_id in other resources to ensure a consistent name.
It's helpful to clearly show which is the original dataset and which is the authorised view of the data with clear names (unsure what "movies" is in this context. )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-named the resources for clarity and tested again to make sure it works.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can remove this empty line
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this sample is not being tested, remove this line and ensure the configuration is production ready. Deletion protection is true by default
| deletion_protection = false # set to "true" in production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in latest commit.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since e.g. project and dataset_id accesses google_bigquery_dataset.default directly, Terraform can infer the dependency and we don't need depends_on explicitly, see https://developer.hashicorp.com/terraform/language/meta-arguments/depends_on.
Same in the other places in this example.
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
glasnt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
google_bigquery_table.default.dataset_id
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
google_bigquery_table.default.table_id
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # 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. | ||
|
|
||
| apiVersion: blueprints.cloud.google.com/v1alpha1 | ||
| kind: BlueprintTest | ||
| metadata: | ||
| name: bigquery_authorized_view_tutorial | ||
glasnt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| spec: | ||
| skip: true | ||
Uh oh!
There was an error while loading. Please reload this page.