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

BQTag Alpha Version #668

Merged
merged 30 commits into from
Jul 28, 2021
Merged

BQTag Alpha Version #668

merged 30 commits into from
Jul 28, 2021

Conversation

ruchirjain86
Copy link
Contributor

First PR for a new tool called as BQTag. Utility class for tagging BQ Table Schemas with Data Catalog Taxonomy Policy Tags. Create BQ Authorised Views using Policy Tags. Helper utility to provision BigQuery Dataset, Data Catalog Taxonomy and Policy Tags.

  • Unit tests are present in "tests" directory. Need Data Catalog and BQ API to be enabled in GCP Project.
  • Example is present in "example" directory.Need Data Catalog and BQ API to be enabled in GCP Project.
  • Readme file is present in the root directory of the tool
  • Higher level Readme has been updated with the link to the tool

@google-cla google-cla bot added the cla: yes All committers have signed a CLA label Jul 12, 2021
@suchitpuri
Copy link
Contributor

/gcbrun

@ruchirjain86
Copy link
Contributor Author

@iht Hi Israel, I would appreciate if you cold review this PR.

@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines. label Jul 26, 2021
@boredabdel
Copy link
Member

@iht do you want to take this one ? I can if you don't have time

@boredabdel
Copy link
Member

/gcbrun

@iht
Copy link
Member

iht commented Jul 27, 2021

Taking this one for review. Starting now.

Copy link
Member

@iht iht left a comment

Choose a reason for hiding this comment

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

Please the inline comments for the specific requested changes.

@ruchirjain86
Copy link
Contributor Author

@iht Thank you Israel for reviewing the code and providing the valuable insights. I have made all the changes suggested by you and pushed it the main branch of my forked repo. Please let me know if any other changes are required.

Copy link
Member

@iht iht left a comment

Choose a reason for hiding this comment

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

Hi, there are still some Python style bits to be fixed. Perhaps you could try to use some tool such as black to reformat the remaining parts of the code: https://www.freecodecamp.org/news/auto-format-your-python-code-with-black/

@ruchirjain86
Copy link
Contributor Author

@iht Thank you for the suggestion. I have formatted the code using black and pushed it to my repo.

I also ran the tests to ensure formatting did not break anything and tests ran fine.

(bqtag) ruchirjain@brahmos:~/opensource/bqtag/tools/bqtag/tests$ python3 test_bqtag.py 
2021-07-28 12:27:12,106 DEBUG BQ Client Initialised.
2021-07-28 12:27:12,132 DEBUG Data Catalog Client Initialised.
2021-07-28 12:27:13,330 INFO Taxonomy Created Successfully.
2021-07-28 12:27:16,453 INFO 3 Tags Created Successfully.
2021-07-28 12:27:16,525 DEBUG BQ Client Initialised.
2021-07-28 12:27:16,527 DEBUG Data Catalog Client Initialised.
2021-07-28 12:27:16,528 DEBUG Determining Taxonomy ID using Taxonomy Name provided.
2021-07-28 12:27:17,605 DEBUG Downloading Policy Tags from Taxonomy.
2021-07-28 12:27:18,625 INFO Policy Tags downlaoded from Taxonomy. Total tags: 3
2021-07-28 12:27:18,630 DEBUG BQ Client Initialised.
2021-07-28 12:27:18,632 DEBUG Data Catalog Client Initialised.
2021-07-28 12:27:18,632 DEBUG Determining Taxonomy ID using Taxonomy Name provided.
2021-07-28 12:27:19,718 DEBUG Downloading Policy Tags from Taxonomy.
2021-07-28 12:27:20,718 INFO Policy Tags downlaoded from Taxonomy. Total tags: 3
2021-07-28 12:27:21,440 INFO Dataset created successfully: bqtag-321212.test_dataset.
2021-07-28 12:27:21,996 INFO Table created successfully: bqtag-321212.test_dataset.test_table.
2021-07-28 12:27:22,002 DEBUG BQ Client Initialised.
2021-07-28 12:27:22,005 DEBUG Data Catalog Client Initialised.
2021-07-28 12:27:22,006 DEBUG Determining Taxonomy ID using Taxonomy Name provided.
2021-07-28 12:27:23,091 DEBUG Downloading Policy Tags from Taxonomy.
2021-07-28 12:27:24,092 INFO Policy Tags downlaoded from Taxonomy. Total tags: 3
2021-07-28 12:27:24,092 DEBUG Start Downloading BQ Schema.
2021-07-28 12:27:24,730 INFO Table schema downloaded. Started View Creation.
2021-07-28 12:27:24,730 DEBUG Query Created: SELECT column2, column1, STRUCT(parent.nested2)  as parent FROM `bqtag-321212.test_dataset.test_table`
2021-07-28 12:27:27,502 INFO Authorised view created: bqtag-321212.test_dataset.test_view_medium

.
----------------------------------------------------------------------
Ran 4 tests in 15.401s

OK

Copy link
Member

@iht iht left a comment

Choose a reason for hiding this comment

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

LGTM

@iht
Copy link
Member

iht commented Jul 28, 2021

/gcbrun

@iht iht merged commit def3751 into GoogleCloudPlatform:main Jul 28, 2021
rosmo pushed a commit to rosmo/professional-services that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes All committers have signed a CLA size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants