Static Tools
Static Tools are pre-built utilities provided by LangDB to facilitate seamless interaction between your models and the database, including its tables. These tools are designed to make you model get information about your tables and a way to query them.
Available Static Tools
-
langdb_raw_query: This tool allows the model to execute a SQL query over the database.
-
langdb_validate_query:This tool allows the model to validate if the generated SQL query is correct.
-
list_tables: This tool allows the model to fetch the table names
-
describe_tables: This tool allows the model to get more details about a specific tables
Best Practices
- Use
langdb_raw_query
for executing custom SQL queries when you need flexibility and control over the database operations. - Leverage
langdb_validate_query
to ensure the correctness of your generated SQL queries before executing them, minimizing the risk of errors and potential database issues. - Utilize
list_tables
to dynamically retrieve the available table names, enabling your model to adapt to changes in the database structure. - Employ
describe_tables
to obtain detailed information about specific tables, such as column names, data types, and constraints, allowing your model to make informed decisions when interacting with the database.
Conclusion
LangDB Static Tools allows you to build various Text-to-SQL models. For a Text-to-SQL usage example, please refer to: [https://app.langdb.ai/samples/text-to-sql]