Skip to content

Commit

Permalink
Bugfix: fix KeyError when metadata raising an MetadataInvalidError. (#…
Browse files Browse the repository at this point in the history
…134)

* Update metadata.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
MooooCat and pre-commit-ci[bot] committed Feb 4, 2024
1 parent ff2022b commit 782bcfe
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions sdgx/data_models/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,7 @@ def check(self):

# for single primary key, it should has ID type
if len(self.primary_keys) == 1 and list(self.primary_keys)[0] not in self.id_columns:
raise MetadataInvalidError(
f"Primary Key {self.primary_keys[0]} should has ID DataType."
)
raise MetadataInvalidError(f"Primary Key {self.primary_keys} should has ID DataType.")

all_dtype_columns = self.get_all_data_type_columns()

Expand Down

0 comments on commit 782bcfe

Please sign in to comment.