Skip to content

SQL Template Matcher #2

@anisbhsl

Description

@anisbhsl

Description

Current implementation uses SQL agent to generate SQL statement when provided with user query. This is inconsistent and it is difficult to railguard the response. To prevent this, create a SQLTemplateMatcher as base class which will have following base classes

  1. FuzzySQLTemplateMatcher : Rule based query to SQL statement
  2. LLMBasedSQLTemplateMatcher : LLM based query to SQL template matcher with entity extraction

Refer to this boilerplate for base class:

class SQLTemplateMatcher:
    def __init__(self, ...):
    ...

    def add_query_template(self, query, sql_statement):
     ...

    def match(self, query) -> list:
         return top k matched sql statements along with entity substition (or we can do subsition in another step)

The constructor could take: table schema, sql templates

Deliverables

  • Base Matcher Class
  • LLM Based SQL Template Matcher
  • Fuzzy SQL Template Matcher
### Tasks
- [ ] https://github.com/NASA-IMPACT/larch/issues/3
- [ ] https://github.com/NASA-IMPACT/larch/issues/4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions