-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Please add support for database views in SQLDatabase #9748
Comments
🤖 That sounds like a great idea! Adding support for database views in SQLDatabase would definitely make the system more flexible and powerful. Your suggestion to include database objects like views along with tables is a valuable enhancement. I encourage you to go ahead and create a pull request with your proposed changes. Your contribution will be appreciated by the community and the maintainers will review it. Thank you for your willingness to improve LlamaIndex! This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
I have no idea how table views would work the sqlalchemy, but I encourage you to take a stab at a PR if you are up to it. The SQLDatabase code is here
|
Looking at sql_wrapper.py, It looks like someone already build in support. In sql_wrapper.py there is this bool: view_support: bool = False, it looks like it's as simple as toggling it. |
Give it a shot, see if it works 🫡 |
Created pull request #9802 Works perfectly fine for me at least |
Hi, @johanteekens, I'm helping the LlamaIndex team manage our backlog and am marking this issue as stale. It looks like you requested adding support for database views in SQLDatabase to enhance the flexibility and power of the SQLTableRetrieverQueryEngine. You've already created pull request #9802, stating that it works perfectly fine for you. Could you please confirm if this issue is still relevant to the latest version of the LlamaIndex repository? If it is, please let the LlamaIndex team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your contribution! If you have any further questions or need assistance, feel free to reach out. I'm Dosu |
Feature Description
current situation: SQLDatabase(engine, include_tables=["city_stats"])
obj_index = ObjectIndex.from_objects(table_schema_objs,table_node_mapping,VectorStoreIndex,)
query_engine = SQLTableRetrieverQueryEngine(sql_database, obj_index.as_retriever(),)
preferred new option: SQLDatabase(engine, include_databaseobjects=["city_stats","myview1","mytable1","myview2"])
Reason
My database tables are virtually unreadable for anything, but I can create views on top of my tables, that explain what is it is, convert julian dates, do lookups etc etc. I can't change the tables because that would break my application, but I can add views.
Value of Feature
SQLTableRetrieverQueryEngine becomes more flexible and powerful.
please........ ;-)
The text was updated successfully, but these errors were encountered: