-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fuzzy table matching part 2 #552
Conversation
@@ -213,6 +214,8 @@ async def _invalidate_memory(self, messages): | |||
invalid_key = validity.invalid_key | |||
if invalid_key == "table": | |||
memory.pop("current_table", None) | |||
memory.pop("current_data", None) |
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.
Pop out stale data
@@ -182,8 +182,9 @@ def use_suggestion(event): | |||
async def _invalidate_memory(self, messages): | |||
table = memory.get("current_table") | |||
sql = memory.get("current_sql") | |||
if not sql: | |||
if not table and not sql: |
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.
Be sure to invalidate table too.
source = memory.get("current_source") | ||
tables = source.get_tables() if source else [] | ||
if len(tables) > FUZZY_TABLE_LENGTH: | ||
closest_tables = await self._get_closest_tables(messages, tables, n=5) | ||
if len(closest_tables) == 0: | ||
# if no tables are found, ask the user to select ones and load it | ||
tables = await self._select_table(tables) | ||
return self.requires + ['current_table'] | ||
elif len(closest_tables) == 1: | ||
return self.requires + ['current_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.
Not needed with better logic in invalidating and checks.
return tuple(closest_tables) | ||
if len(closest_tables) == 0: | ||
# if no tables are found, ask the user to select ones and load it | ||
tables = await self._select_table(tables) |
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.
Only select if unavailable to auto select.
No description provided.