-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[embedded-elt] Decoupling connections from resource allocation (#18270)
## Summary & Motivation This PR proposes an alternative pattern to using Sling that uses a new Resource called `SlingConnectionResource` and builder method called `build_assets_from_sling_stream`. Names tentative. Developers that use these objects can compose and mix-and-match the sources and targets interoperably by pushing the coupling down to the builder method. ie. in this snippet from a unit test, two different sources are synced to the same target database. ```python sling_file_connection=SlingConnectionResource(type="file") sling_staging_file_connection=SlingConnectionResource(type="file") sling_sqlite_connection=SlingConnectionResource(type="sqlite", connection_string=f"sqlite://{temp_db}") asset_def = build_assets_from_sling_stream( sling_file_connection, sling_sqlite_connection, stream=f"file://{test_csv}", target_object="main.tbl", mode=SlingMode.FULL_REFRESH, primary_key="SPECIES_CODE", ) asset_def_two = build_assets_from_sling_stream( sling_staging_file_connection, sling_sqlite_connection, stream=f"file://{test_staging_csv}", target_object="main.staging_tbl", mode=SlingMode.FULL_REFRESH, primary_key="SPECIES_CODE", ) ``` ## How I Tested These Changes Unit tests
- Loading branch information
1 parent
ac0cbb1
commit 822d653
Showing
5 changed files
with
504 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.