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

Bug: refetch fields on has_field failure #595

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions dagshub/data_engine/model/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,9 +1324,19 @@ def has_field(self, field_name: str) -> bool:
"""
Checks if a metadata field ``field_name`` exists in the datasource.
"""
reserved_searchable_fields = ["path"]
fields = (f.name for f in self.fields)
return field_name in reserved_searchable_fields or field_name in fields

def _check():
reserved_searchable_fields = ["path"]
fields = (f.name for f in self.fields)
return field_name in reserved_searchable_fields or field_name in fields

res = _check()
# Refetch fields once - maybe things got updated
if not res:
self.source.get_from_dagshub()
res = _check()

return res

def __repr__(self):
res = f"Datasource {self.source.name}"
Expand Down