The CrewAI NL2SQL works with MySQL but does not work with MS SQL which is what would be needed in the real world scenarios.
Below is an initial analysis, does anyone have alternate working setup/tool with MSSQL with langchain(SQLDatabase) working along with CrewAI?
I could see that the dialect used here could be : mssql+pyodbc or msmsql+pymssql in the db uri. As an initial analysis in NL2SQL post_init() method of nl2sql_tool.py the below is invoked, the below is not correct for the MsSql asa table_schema would be ‘dbo’. This works for Mysql but not MS SQL + Additionally some cursor/result handling needs to be updated:
def _fetch_available_tables(self):
return self.execute_sql(
“SELECT table_name FROM information_schema.tables WHERE table_schema = ‘public’;”
)