Skip to content
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

Add table gcp_bigquery_table closes #191 #198

Merged
merged 8 commits into from
May 13, 2021
Merged

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented May 12, 2021

Integration test logs

Logs
No env file present for the current environment:  staging 
 Falling back to .env config
No env file present for the current environment:  staging
customEnv TURBOT_TEST_EXPECTED_TIMEOUT 300

SETUP: tests/gcp_bigquery_table []

PRETEST: tests/gcp_bigquery_table

TEST: tests/gcp_bigquery_table
Running terraform
data.google_client_config.current: Refreshing state...
data.null_data_source.resource: Refreshing state...
google_bigquery_dataset.named_test_resource: Creating...
google_service_account.named_test_resource: Creating...
google_bigquery_dataset.named_test_resource: Creation complete after 4s [id=projects/pikachu-aaa/datasets/turbottest53721]
google_bigquery_table.named_test_resource: Creating...
google_service_account.named_test_resource: Creation complete after 5s [id=projects/pikachu-aaa/serviceAccounts/turbottest53721@pikachu-aaa.iam.gserviceaccount.com]
google_bigquery_table.named_test_resource: Creation complete after 4s [id=projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721]

Warning: Deprecated Resource

The null_data_source was historically used to construct intermediate values to
re-use elsewhere in configuration, the same can now be achieved using locals


Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Outputs:

etag = dOVVbzh7xzv5w6CQOevhLw==
project_id = pikachu-aaa
region_id = us-east1
resource_aka = gcp://bigquery.googleapis.com/projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721
resource_id = projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721
resource_name = turbottest53721
self_link = https://bigquery.googleapis.com/bigquery/v2/projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721
service_account_email = turbottest53721@pikachu-aaa.iam.gserviceaccount.com

Running SQL query: test-get-query.sql
[
  {
    "dataset_id": "turbottest53721",
    "id": "pikachu-aaa:turbottest53721.turbottest53721",
    "kind": "bigquery#table",
    "labels": {
      "name": "turbottest53721"
    },
    "location": "us-east1",
    "project": "pikachu-aaa",
    "range_partitioning": null,
    "self_link": "https://bigquery.googleapis.com/bigquery/v2/projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721",
    "table_id": "turbottest53721",
    "time_partitioning": {
      "type": "DAY"
    },
    "title": "turbottest53721",
    "type": "TABLE"
  }
]
✔ PASSED

Running SQL query: test-invalid-name-query.sql
null
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "dataset_id": "turbottest53721",
    "table_id": "turbottest53721"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "gcp://bigquery.googleapis.com/projects/pikachu-aaa/datasets/turbottest53721/tables/turbottest53721"
    ],
    "tags": {
      "name": "turbottest53721"
    },
    "title": "turbottest53721"
  }
]
✔ PASSED

POSTTEST: tests/gcp_bigquery_table

TEARDOWN: tests/gcp_bigquery_table

SUMMARY:

1/1 passed.

Example query results

Results

Basic info

select
  table_id,
  dataset_id,
  self_link,
  creation_time,
  location
from
  gcp_bigquery_table;
+--------------+----------------+--------------------------------------------------------------------------------------------------------------+---------------------+----------+
| table_id     | dataset_id     | self_link                                                                                                    | creation_time       | location |
+--------------+----------------+--------------------------------------------------------------------------------------------------------------+---------------------+----------+
| test_table_1 | test_dataset_1 | https://bigquery.googleapis.com/bigquery/v2/projects/pikachu-aaa/datasets/test_dataset_1/tables/test_table_1 | 2021-05-13 05:08:41 | US       |
+--------------+----------------+--------------------------------------------------------------------------------------------------------------+---------------------+----------+

List tables which are not encrypted using CMK

select
  table_id,
  dataset_id,
  location,
  kms_key_name
from
  gcp_bigquery_table
where
  kms_key_name is null;
+--------------+----------------+----------+--------------+
| table_id     | dataset_id     | location | kms_key_name |
+--------------+----------------+----------+--------------+
| test_table_1 | test_dataset_1 | US       | <null>       |
+--------------+----------------+----------+--------------+

List tables which do not have owner tag key

select
  dataset_id,
  location
from
  gcp_bigquery_table
where
  tags -> 'owner' is null;
+----------------+----------+
| dataset_id     | location |
+----------------+----------+
| test_dataset_1 | US       |
+----------------+----------+

@ParthaI ParthaI requested a review from Subhajit97 May 12, 2021 05:08
@ParthaI ParthaI self-assigned this May 12, 2021
@ParthaI ParthaI linked an issue May 12, 2021 that may be closed by this pull request
gcp/plugin.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Subhajit97 Subhajit97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ParthaI Added some suggestions. Please see comments, thanks!

Copy link
Contributor

@Subhajit97 Subhajit97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@rajlearner17 rajlearner17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Subhajit97 Subhajit97 requested a review from cbruno10 May 13, 2021 12:12
@cbruno10 cbruno10 merged commit c9fafe0 into main May 13, 2021
@cbruno10 cbruno10 deleted the add-table-gcp-bigquery branch May 13, 2021 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table gcp_bigquery_table
4 participants