You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "aless10 (via GitHub)" <gi...@apache.org> on 2023/08/10 12:11:23 UTC

[GitHub] [iceberg] aless10 opened a new pull request, #8286: [#7982] delegate serialization to pydantic

aless10 opened a new pull request, #8286:
URL: https://github.com/apache/iceberg/pull/8286

   (It should) closes #7982 
   
   TableMetadataUtil has a `parse_raw` method where it receives a string that will be parsed by a pydantic model. This model will also return the correct TableMetadata version based on the field `format_version`. 
   This is like a strategy method that is now handled with a pydantic model (before, there were a couple of if statements).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290357240


##########
python/pyiceberg/table/metadata.py:
##########
@@ -303,7 +306,7 @@ def to_v2(self) -> "TableMetadataV2":
         metadata["format_version"] = 2
         return TableMetadataV2(**metadata)
 
-    format_version: Literal[1] = Field(alias="format-version")
+    format_version: Literal[1] = Field(alias="format-version", default=1)

Review Comment:
   Ok, I set it here because there is the default in the v2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290696996


##########
python/pyiceberg/catalog/rest.py:
##########
@@ -113,7 +113,7 @@ class Endpoints:
 
 class TableResponse(IcebergBaseModel):
     metadata_location: str = Field(alias="metadata-location")
-    metadata: TableMetadata = Field()

Review Comment:
   After using Annotated, I got this error
   ```ValueError: cannot specify `Annotated` and value `Field`s together for 'metadata'```
   So, I remove it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290363010


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   Btw, I don't like the solution that I found, but it works



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #8286: [#7982] delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290115198


##########
python/pyiceberg/catalog/rest.py:
##########
@@ -113,7 +113,7 @@ class Endpoints:
 
 class TableResponse(IcebergBaseModel):
     metadata_location: str = Field(alias="metadata-location")
-    metadata: TableMetadata = Field()

Review Comment:
   Did you remove the `= Field()` for a specific reason?



##########
python/tests/table/test_metadata.py:
##########
@@ -76,12 +76,12 @@ def example_table_metadata_v1() -> Dict[str, Any]:
 
 def test_from_dict_v1(example_table_metadata_v1: Dict[str, Any]) -> None:
     """Test initialization of a TableMetadata instance from a dictionary"""
-    TableMetadataUtil.parse_obj(example_table_metadata_v1)
+    TableMetadataUtil.parse_raw(json.dumps(example_table_metadata_v1))

Review Comment:
   I think for testing we're okay with leaving as it was.



##########
python/pyiceberg/table/metadata.py:
##########
@@ -353,7 +356,7 @@ def check_sort_orders(cls, values: Dict[str, Any]) -> Dict[str, Any]:
     increasing long that tracks the order of snapshots in a table."""
 
 
-TableMetadata = Union[TableMetadataV1, TableMetadataV2]
+TableMetadata = Annotated[Union[TableMetadataV1, TableMetadataV2], Field(discriminator="format_version")]

Review Comment:
   Love it



##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   The use of the wrapper doesn't make sense to me. Shouldn't 
   ```suggestion
               metadata_wrapper = TableMetadata.parse_raw(d)
   ```
   work?



##########
python/pyiceberg/table/metadata.py:
##########
@@ -303,7 +306,7 @@ def to_v2(self) -> "TableMetadataV2":
         metadata["format_version"] = 2
         return TableMetadataV2(**metadata)
 
-    format_version: Literal[1] = Field(alias="format-version")
+    format_version: Literal[1] = Field(alias="format-version", default=1)

Review Comment:
   I don't think we can set a default here, it is missing, we should raise an exception.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290367343


##########
python/tests/table/test_metadata.py:
##########
@@ -76,12 +76,12 @@ def example_table_metadata_v1() -> Dict[str, Any]:
 
 def test_from_dict_v1(example_table_metadata_v1: Dict[str, Any]) -> None:
     """Test initialization of a TableMetadata instance from a dictionary"""
-    TableMetadataUtil.parse_obj(example_table_metadata_v1)
+    TableMetadataUtil.parse_raw(json.dumps(example_table_metadata_v1))

Review Comment:
   Yes, for the tests I think `parse_obj` is fine



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290368092


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   I see, I also looked into the discriminator to automatically deserialize into the right version. Would be great to get it working, but it is a bit rough it seems.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290364214


##########
python/tests/table/test_metadata.py:
##########
@@ -76,12 +76,12 @@ def example_table_metadata_v1() -> Dict[str, Any]:
 
 def test_from_dict_v1(example_table_metadata_v1: Dict[str, Any]) -> None:
     """Test initialization of a TableMetadata instance from a dictionary"""
-    TableMetadataUtil.parse_obj(example_table_metadata_v1)
+    TableMetadataUtil.parse_raw(json.dumps(example_table_metadata_v1))

Review Comment:
   So, we are going to have a `parse_obj` method that works like before. Is that correct?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1291272885


##########
python/pyiceberg/catalog/rest.py:
##########
@@ -113,7 +113,7 @@ class Endpoints:
 
 class TableResponse(IcebergBaseModel):
     metadata_location: str = Field(alias="metadata-location")
-    metadata: TableMetadata = Field()

Review Comment:
   Ah makes sense, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1291005819


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   The discriminator works if it is a field in a model. But it does not work per se. We can use it as I did or implement a sort of factory method (as it is right now)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1291292807


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   I tried to look at what pydantic does and basically it takes the string and then calls json.load. So one of the thing that we can do is:
   1. move the json.load call inside this method
   2. call the parse_object: now we don't have to concatenate the string since the object is the correct one



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on pull request #8286: [#7982] delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#issuecomment-1673101868

   I hope that I understand what the issue is about. If not, I'd like to fix it. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1290362107


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   So, TableMetadata is a type, not a pydantic model. So it does not have the parse_raw method. I get that we want to achieve this. I'll try to study pydantic more to see if it is possible to achieve this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1291302567


##########
python/pyiceberg/table/metadata.py:
##########
@@ -380,19 +383,14 @@ def new_table_metadata(
 class TableMetadataUtil:
     """Helper class for parsing TableMetadata."""
 
-    # Once this has been resolved, we can simplify this: https://github.com/samuelcolvin/pydantic/issues/3846
-    # TableMetadata = Annotated[TableMetadata, Field(alias="format-version", discriminator="format-version")]
+    class _MetadataWrapper(IcebergBaseModel):
+        table_metadata: TableMetadata
 
     @staticmethod
-    def parse_obj(data: Dict[str, Any]) -> TableMetadata:
-        if "format-version" not in data:
-            raise ValidationError(f"Missing format-version in TableMetadata: {data}")
-
-        format_version = data["format-version"]
-
-        if format_version == 1:
-            return TableMetadataV1(**data)
-        elif format_version == 2:
-            return TableMetadataV2(**data)
-        else:
-            raise ValidationError(f"Unknown format version: {format_version}")
+    def parse_raw(data: str) -> TableMetadata:
+        try:
+            d = f'{{"table_metadata": {data}}}'
+            metadata_wrapper = TableMetadataUtil._MetadataWrapper.parse_raw(d)

Review Comment:
   I'm also bumping Pydantic to 2.0: https://github.com/apache/iceberg/pull/7782 Maybe we can see if that offers something new. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] aless10 commented on a diff in pull request #8286: Python: Delegate serialization to pydantic

Posted by "aless10 (via GitHub)" <gi...@apache.org>.
aless10 commented on code in PR #8286:
URL: https://github.com/apache/iceberg/pull/8286#discussion_r1291293948


##########
python/tests/table/test_metadata.py:
##########
@@ -76,12 +76,12 @@ def example_table_metadata_v1() -> Dict[str, Any]:
 
 def test_from_dict_v1(example_table_metadata_v1: Dict[str, Any]) -> None:
     """Test initialization of a TableMetadata instance from a dictionary"""
-    TableMetadataUtil.parse_obj(example_table_metadata_v1)
+    TableMetadataUtil.parse_raw(json.dumps(example_table_metadata_v1))

Review Comment:
   Ok, but still I have to add tests for the new method. So, it's like duplicating the test but call another method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko merged pull request #8286: Python: Delegate serialization to pydantic

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #8286:
URL: https://github.com/apache/iceberg/pull/8286


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org