Conversation
|
|
||
| def __str__(self) -> str: | ||
| """Return the string representation of the SnapshotRefType class.""" | ||
| return self.value |
There was a problem hiding this comment.
Seems we need this __str__. Otherwise,
>>> ref_type=SnapshotRefType.Branch
>>> f"Test: {ref_type}"will show Test: SnapshotRefType.Branch in my local environment (Python 3.11) but Test: branch in CI's python 3.8. I think it's because Python 3.11 changes the default behavior of Enum's str: https://blog.pecar.me/python-enum
Fokko
left a comment
There was a problem hiding this comment.
Some small comments, but looks good 👍
|
|
||
| type: Literal["assert-create"] = Field(default="assert-create") | ||
|
|
||
| def validate(self, base_metadata: Optional[TableMetadata]) -> None: |
There was a problem hiding this comment.
Should we update the signature of the parent class as well?
There was a problem hiding this comment.
Thanks for the suggestion! I updated the signature and also add None-checks for other requirements, which will raise exception when the current table metadata is None.
This PR is the second part of #140
It implements a
validatemethod for each table requirement. This method raises aCommitFailedExceptionwith an appropriate error message if the table's metadata does not meet the requirements.