Skip to content

Commit

Permalink
Add support for searching all owners
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmcalpine committed Oct 29, 2024
1 parent 6638120 commit b81e915
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/dataregistry_cli/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ def _render_filters(datareg, args):
queriables = ["owner", "owner_type", "name"]

print("\nDataRegistry query:", end=" ")
if not args.all:
for col in queriables:
# Add filter on this column
if getattr(args, col) is not None:
if col == "name":
filters.append(Filter(f"dataset.{col}", "~=", getattr(args, col)))
else:
for col in queriables:
# Add filter on this column
if getattr(args, col) is not None:
if col == "name":
filters.append(Filter(f"dataset.{col}", "~=", getattr(args, col)))
else:
if not (col == "owner" and getattr(args, col).lower() == "none"):
filters.append(Filter(f"dataset.{col}", "==", getattr(args, col)))
print(f"{col}=={getattr(args, col)}", end=" ")
else:
print("all datasets", end=" ")
print(f"{col}=={getattr(args, col)}", end=" ")

# Add keywords filter
if args.keyword is not None:
Expand Down

0 comments on commit b81e915

Please sign in to comment.