-
Notifications
You must be signed in to change notification settings - Fork 187
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
Sqlalchemy staging dataset support and docs #1841
Conversation
* Remember sqlite attached datasets * Merge fallback to append
✅ Deploy Preview for dlt-hub-docs canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs are looking good! Please enable tests for replace strategies which all start like this:
@pytest.mark.parametrize("replace_strategy", REPLACE_STRATEGIES)
def test_replace_disposition(
destination_config: DestinationTestConfiguration, replace_strategy: str
) -> None:
if not destination_config.supports_merge and replace_strategy != "truncate-and-insert":
pytest.skip(
f"Destination {destination_config.name} does not support merge and thus"
f" {replace_strategy}"
)
also could you change one of the replace test to use write_disposition spec as dictionary? right now we use env variable to set the strategy. both should work:
@dlt.resource(name="items", write_disposition="replace", primary_key="id")
def load_items():
Ah I see, they're not running without merge. I saw the TODO to add
Sure! |
@rudolfix is this supported yet? |
OK, right. we have this defined only for merge, but it is prepared for other dispositions TWriteDisposition = Literal["skip", "append", "replace", "merge"]
TLoaderMergeStrategy = Literal["delete-insert", "scd2", "upsert"]
WRITE_DISPOSITIONS: Set[TWriteDisposition] = set(get_args(TWriteDisposition))
MERGE_STRATEGIES: Set[TLoaderMergeStrategy] = set(get_args(TLoaderMergeStrategy))
DEFAULT_VALIDITY_COLUMN_NAMES = ["_dlt_valid_from", "_dlt_valid_to"]
"""Default values for validity column names used in `scd2` merge strategy."""
class TWriteDispositionDict(TypedDict):
disposition: TWriteDisposition
class TMergeDispositionDict(TWriteDispositionDict, total=False):
strategy: Optional[TLoaderMergeStrategy]
validity_column_names: Optional[List[str]]
active_record_timestamp: Optional[TAnyDateTime]
boundary_timestamp: Optional[TAnyDateTime]
row_version_column_name: Optional[str]
TWriteDispositionConfig = Union[TWriteDisposition, TWriteDispositionDict, TMergeDispositionDict] OK to move it to followup ticket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Please see comment on followup ticket.
Description
Related Issues
Additional Context