Skip to content

[FEATURE] Experimental Splitter connection testing #7051

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

Merged
merged 50 commits into from
Feb 6, 2023

Conversation

NathanFarmer
Copy link
Contributor

@NathanFarmer NathanFarmer commented Feb 5, 2023

Changes proposed in this pull request:

  • GREAT-1490
  • Add connection_test for ColumnSplitter
  • Leverage Generic TypeVar ColumnSplitterType in anticipation of additional Splitter classes/methods and the need for connection testing for TableAsset splitters, but not QueryAsset splitters
  • Refactor Sqlite splitters to bring in line with other splitter patterns and remove isinstance/type ignores
  • Introduce Generic TypeVar ExecutionEngineType for passing along Datasource.get_execution_engine() typing information
  • Make Datasource test_connection error message unit test less brittle

Definition of Done

  • My code follows the Great Expectations style guide
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added unit tests where applicable and made sure that new and existing tests are passing.
  • I have run any local integration tests and made sure that nothing is broken.

@netlify
Copy link

netlify bot commented Feb 5, 2023

Deploy Preview for niobium-lead-7998 ready!

Name Link
🔨 Latest commit 54eb852
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/63e16fd99eed300008278b2a
😎 Deploy Preview https://deploy-preview-7051--niobium-lead-7998.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ghost
Copy link

ghost commented Feb 5, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

)


class _SplitterMixin:
class SqliteTableAsset(TableAsset):
Copy link
Contributor Author

@NathanFarmer NathanFarmer Feb 6, 2023

Choose a reason for hiding this comment

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

Hopefully I'm not missing anything regarding the benefits of these mixins, but it doesn't seem as scalable as we will likely continue to require dialect-specific SQLAssets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, moving to inheritance gets rid of the isinstance checks and type: ignores.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was about removing verbosity but this looks better to me.

@NathanFarmer NathanFarmer marked this pull request as ready for review February 6, 2023 16:45
@@ -278,7 +303,9 @@ def get_batch_list_from_batch_request(
)
# Creating the batch_spec is our hook into the execution engine.
batch_spec = SqlAlchemyDatasourceBatchSpec(**batch_spec_kwargs)
execution_engine: ExecutionEngine = self.datasource.get_execution_engine()
execution_engine: SqlAlchemyExecutionEngine = (
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ for type narrowing here as well as in the file-path (Pandas, Spark) cases!

Copy link
Contributor

@alexsherstinsky alexsherstinsky left a comment

Choose a reason for hiding this comment

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

@NathanFarmer I am approving, but please do not merge until someone else with more experience in the ZEP world provides feedback as well. I left a note for consideration. For a slightly longer term (within a couple of days), I am also working on a hypothesis for leveraging Data Connectors within the new Asset in the file path modules (Pandas, Spark), which, if works, might entail some beneficial refactoring opportunities in the SQL ZEP modules as well. Thanks!

@Kilo59
Copy link
Contributor

Kilo59 commented Feb 6, 2023

Everything looks good.
I especially like all the improved generics work 🚀 .

The only thing I might consider blocking is the SQLAsset type-alias, which I'd like to handle differently.
#7051 (comment)

@Kilo59 Kilo59 added the zep Zero Entry Pool work label Feb 6, 2023
@NathanFarmer NathanFarmer enabled auto-merge (squash) February 6, 2023 21:23
@NathanFarmer NathanFarmer merged commit 69ad938 into develop Feb 6, 2023
@NathanFarmer NathanFarmer deleted the f/GREAT-1490/splitter-connection-testing branch February 6, 2023 22:19
@@ -335,22 +338,22 @@ class Datasource(
}
# Setting this in a Datasource subclass will override the execution engine type.
# The primary use case is to inject an execution engine for testing.
execution_engine_override: ClassVar[Optional[Type[ExecutionEngine]]] = None
execution_engine_override: ClassVar[Optional[Type[_ExecutionEngineT]]] = None # type: ignore[misc]
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the details behind this new type ignore? That is, I am curious what the error message is if you don't have this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Message: ClassVar cannot contain type variables. I added a comment in this PR: #7010

)


class _SplitterMixin:
class SqliteTableAsset(TableAsset):
Copy link
Contributor

Choose a reason for hiding this comment

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

It was about removing verbosity but this looks better to me.

Shinnnyshinshin pushed a commit that referenced this pull request Feb 7, 2023
… of https://github.com/great-expectations/great_expectations into f/dx-244/dx-247/sql-column-pair-and-multi-column-id-pk

* 'f/dx-244/dx-247/sql-column-pair-and-multi-column-id-pk' of https://github.com/great-expectations/great_expectations:
  [FEATURE] ID/PK `ColumnPairExpectations` and `MultiColumnMapExpectations` - Spark (#7001)
  [FEATURE] Experimental Splitter connection testing (#7051)
  [DOCS] Add new `DataContext` CRUD to public API (#7058)
  [FEATURE] ZEP - generate pandas assets (#7044)
  [MAINTENANCE] fix - `FutureWarning: pandas.Float64Index is deprecated` when importing `great_expectations` (#7055)
  [MAINTENANCE] finish linting `great_expectations` (#7050)
  [MAINTENANCE] ruff `0.0.241` (#7048)
  [MAINTENANCE] Standardize `Checkpoint` CRUD (#6962)
  [MAINTENANCE] replace `isort` with `ruff` sorting rules (#6907)
  [MAINTENANCE] Minor Cleanup (#7047)
  [FEATURE] Experimental `DataAsset` `test_connection` (#7019)
  [FEATURE] Add SQL query data asset for new experimental datasources (#6999)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-team platform zep Zero Entry Pool work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants