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

Get view names along with tables #498

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Get view names along with tables #498

wants to merge 8 commits into from

Conversation

Kilo59
Copy link
Contributor

@Kilo59 Kilo59 commented Oct 21, 2024

Return views along with table names.

Given that we no longer support QueryAsset types in GX-Cloud, users need to be able to import views along with tables when adding assets from the UI.

https://docs.sqlalchemy.org/en/20/core/reflection.html#sqlalchemy.engine.reflection.Inspector

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (4f23d41) to head (ccf70ed).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #498      +/-   ##
==========================================
+ Coverage   87.96%   88.00%   +0.04%     
==========================================
  Files          24       24              
  Lines        1030     1034       +4     
==========================================
+ Hits          906      910       +4     
  Misses        124      124              
Flag Coverage Δ
3.10 74.08% <100.00%> (+0.10%) ⬆️
3.11 74.08% <100.00%> (+0.10%) ⬆️
3.9 73.93% <100.00%> (+0.10%) ⬆️
integration 71.08% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Kilo59 Kilo59 self-assigned this Oct 21, 2024
@Kilo59 Kilo59 requested a review from elenajdanova October 21, 2024 15:14
@Kilo59 Kilo59 assigned DrewHoo and unassigned Kilo59 Oct 21, 2024
@@ -69,9 +69,12 @@ def check_draft_datasource_config(
created_resources=[],
)

def _get_table_names(self, datasource: Datasource) -> list[str]:
def _get_table_names(self, datasource: Datasource, *, include_views: bool) -> list[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename to _get_table_and_view_names and remove the boolean flag. We don't have a need for the conditional and it makes the API less clear.

@@ -1,6 +1,6 @@
[tool.poetry]
name = "great_expectations_cloud"
version = "20241017.0.dev1"
version = "20241021.0.dev0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

outdated

Comment on lines +173 to 176
_get_table_names_spy.assert_called_with(
datasource=datasource_cls(**datasource_config), include_views=True
)
_update_table_names_list_spy.assert_called_with(config_id=config_id, table_names=table_names)
Copy link
Collaborator

Choose a reason for hiding this comment

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

These assertions don't add any value to the test and make refactoring harder. Testing that a method calls a private helper makes no guarantee that what the helper is doing is correct.

These tests is already verifying that the correct endpoint is called with the correct tables/views and that is enough

Copy link
Collaborator

Choose a reason for hiding this comment

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

Some tests here should guarantee that we return views as well

inspector = mocker.Mock(spec=Inspector)
inspector.get_table_names.return_value = table_names
inspector.get_view_names.return_value = view_names
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would expect this test to fail since we're not getting different results. The test should guarantee that we're sending back the correct results

@elenajdanova elenajdanova removed their request for review December 19, 2024 18:42
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.

5 participants