-
Notifications
You must be signed in to change notification settings - Fork 4
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
(feat): Sql registry search #105
base: master
Are you sure you want to change the base?
Changes from all commits
e72d06d
8baa538
0c720a6
8180b67
19a6694
54e8728
b81c885
6319ab3
dfdc511
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,10 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu | |
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | ||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= | ||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | ||
github.com/gonuts/commander v0.1.0 h1:EcDTiVw9oAVORFjQOEOuHQqcl6OXMyTgELocTq6zJ0I= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this. |
||
github.com/gonuts/commander v0.1.0/go.mod h1:qkb5mSlcWodYgo7vs8ulLnXhfinhZsZcm6+H/z1JjgY= | ||
github.com/gonuts/flag v0.1.0 h1:fqMv/MZ+oNGu0i9gp0/IQ/ZaPIDoAZBOBaJoV7viCWM= | ||
github.com/gonuts/flag v0.1.0/go.mod h1:ZTmTGtrSPejTo/SRNhCqwLTmiAgyBdCkLYhHrAoBdz4= | ||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= | ||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= | ||
github.com/google/flatbuffers v2.0.5+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
import concurrent.futures | ||
import logging | ||
import threading | ||
|
@@ -919,6 +921,7 @@ def get_user_metadata( | |
|
||
def proto(self) -> RegistryProto: | ||
r = RegistryProto() | ||
|
||
# last_updated_timestamps = [] | ||
|
||
def process_project(project): | ||
|
@@ -1063,6 +1066,80 @@ def create_project_if_not_exists(self, project): | |
if new_project: | ||
self._set_last_updated_metadata(update_datetime, project) | ||
|
||
def search( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was under the impression search should be implemented using full text search. Is pagination implemented in this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About Full Text Search, is that expectation set with Workbench team? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remote registry leverages, Sql Registry so we will have the functionality. We don't need to reimplement. Just method definition in remote registry should help until we contribute the functionality. Looking for answers to my questions above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Full text search in this context means "feature view and project names". |
||
self, | ||
name="", | ||
application="", | ||
owning_team="", | ||
created_at=datetime.min, | ||
updated_at=datetime.min, | ||
online=False, | ||
) -> List[Union[FeatureView, ProjectMetadataModel]]: | ||
""" | ||
Search for feature views or projects based on the provided search | ||
parameters. Since the SQL database stores only metadata and protos, we | ||
have to pull all potentially matching objects and filter in memory. | ||
""" | ||
fv_list = [] | ||
with self.engine.connect() as conn: | ||
stmt = select(feature_views) | ||
if name: | ||
stmt = stmt.where(feature_views.c.feature_view_name == name) | ||
|
||
rows = conn.execute(stmt).all() | ||
|
||
if rows: | ||
fv_list = [ | ||
FeatureView.from_proto( | ||
FeatureViewProto.FromString(row["feature_view_proto"]) | ||
) | ||
for row in rows | ||
] | ||
|
||
fv_list = [ | ||
view | ||
for view in fv_list | ||
if view.created_timestamp is None | ||
or view.created_timestamp >= created_at | ||
] | ||
|
||
fv_list = [ | ||
view | ||
for view in fv_list | ||
if view.last_updated_timestamp is None | ||
or view.last_updated_timestamp >= updated_at | ||
] | ||
|
||
if owning_team: | ||
fv_list = [ | ||
view for view in fv_list if view.tags.get("team") == owning_team | ||
] | ||
if application: | ||
fv_list = [ | ||
view | ||
for view in fv_list | ||
if view.tags.get("application") == application | ||
] | ||
if online is not None: | ||
fv_list = [view for view in fv_list if view.online == online] | ||
|
||
project_list = self.get_all_project_metadata() | ||
|
||
project_list = [ | ||
project for project in project_list if project.project_name == name | ||
] | ||
project_list = [ | ||
project | ||
for project in project_list | ||
if project.last_updated_timestamp is None | ||
or project.last_updated_timestamp >= updated_at | ||
] | ||
|
||
final_list: List[FeatureView | ProjectMetadataModel] = [] | ||
final_list.extend(project_list) | ||
final_list.extend(fv_list) | ||
return final_list | ||
|
||
def _delete_object( | ||
self, | ||
table: Table, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this.