Skip to content
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

Sameerawi/rest client delta table version upgrade #629

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions python/delta_sharing/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@dataclass(frozen=True)
class DeltaSharingProfile:
CURRENT: ClassVar[int] = 2
CURRENT: ClassVar[int] = 3

share_credentials_version: int
endpoint: str
Expand Down Expand Up @@ -159,7 +159,7 @@ def from_json(json) -> "Table":

@dataclass(frozen=True)
class Protocol:
CURRENT: ClassVar[int] = 1
CURRENT: ClassVar[int] = 3

min_reader_version: int

Expand Down
17 changes: 15 additions & 2 deletions python/delta_sharing/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,24 @@ def query_table_metadata(self, table: Table) -> QueryTableMetadataResponse:
lines = values[1]
protocol_json = json.loads(next(lines))
metadata_json = json.loads(next(lines))

if "deltaProtocol" in protocol_json["protocol"]:
protocol = Protocol.from_json(
json.dumps(protocol_json["protocol"]["deltaProtocol"]))
else:
protocol = Protocol.from_json(json.dumps(protocol_json["protocol"]))

if "deltaMetadata" in metadata_json["metaData"]:
metadata = Metadata.from_json(
json.dumps(metadata_json["metaData"]["deltaMetadata"]))
else:
metadata = Metadata.from_json(json.dumps(metadata_json["metaData"]))

return QueryTableMetadataResponse(
delta_table_version=int(headers.get(
DataSharingRestClient.DELTA_TABLE_VERSION_HEADER)),
protocol=Protocol.from_json(protocol_json["protocol"]),
metadata=Metadata.from_json(metadata_json["metaData"]),
protocol=protocol,
metadata=metadata
)

@retry_with_exponential_backoff
Expand Down
Loading