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

Avoid unnecessary grant call #791

Merged
merged 6 commits into from
Jun 26, 2023

Conversation

colin-rogers-dbt
Copy link
Contributor

resolves #770

Description

remove call to dataset update if dataset has not changed

Checklist

@colin-rogers-dbt colin-rogers-dbt requested a review from a team as a code owner June 26, 2023 17:53
@colin-rogers-dbt colin-rogers-dbt self-assigned this Jun 26, 2023
@cla-bot cla-bot bot added the cla:yes label Jun 26, 2023
@@ -24,7 +24,7 @@ def test_add_access_entry_to_dataset_idempotently_adds_entries():
dataset = add_access_entry_to_dataset(dataset, access_entry)
assert access_entry in dataset.access_entries
dataset = add_access_entry_to_dataset(dataset, access_entry)
assert len(dataset.access_entries) == 1
assert dataset is None
Copy link
Contributor

Choose a reason for hiding this comment

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

I would argue this is not idempotent if running it once adds an attribute and running it twice deletes the object. Are you sure this is the right desired behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should rename these tests because you're rightly calling out that this operation should no longer be considered idempotent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok. I looked at where the code is used. It looks like dataset is representing the change in access entries, not the dataset itself. Could we update the name of dataset, add_access_entry_to_dataset, or both, or make that more explicit somehow? It's not intuitive to me that add_access_entry_to_dataset(dataset, access_entry) would delete dataset if access_entry were already contained in dataset.access_entries.

@colin-rogers-dbt colin-rogers-dbt merged commit 85efa2a into main Jun 26, 2023
@colin-rogers-dbt colin-rogers-dbt deleted the avoidUnnecessaryDatasetUpdateCalls branch June 26, 2023 22:40
github-actions bot pushed a commit that referenced this pull request Jun 26, 2023
* remove call to dataset update if dataset has not changed

* add changie

* fix unit test naming

* seperate entry check from update

---------

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
(cherry picked from commit 85efa2a)
colin-rogers-dbt added a commit that referenced this pull request Jun 27, 2023
* remove call to dataset update if dataset has not changed

* add changie

* fix unit test naming

* seperate entry check from update

---------

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
(cherry picked from commit 85efa2a)

Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ADAP-622] [Regression] Authorised views grant_access_to exceeded rate limit error
2 participants