Find answers from the community

Updated last month

Table Description for Instructors

Plain Text
INFO:llama_index.core.indices.struct_store.sql_retriever:> Table desc str: Table 'instructors' has columns: id (INTEGER), name (VARCHAR), email (VARCHAR), organization (VARCHAR), exam_name (VARCHAR), date_created (DATETIME), and foreign keys: .
INFO:httpx:HTTP Request: POST https://integrate.api.nvidia.com/v1/chat/completions "HTTP/1.1 200 OK"
2024-11-02 00:30:28,341 INFO sqlalchemy.engine.Engine BEGIN (implicit)
INFO:sqlalchemy.engine.Engine:BEGIN (implicit)
2024-11-02 00:30:28,341 INFO sqlalchemy.engine.Engine INSERT INTO instructors (name, email, organization, exam_name) VALUES ('John Doe', 'great@good.com', 'numver1', 'special term');
INFO:sqlalchemy.engine.Engine:INSERT INTO instructors (name, email, organization, exam_name) VALUES ('John Doe', 'great@good.com', 'numver1', 'special term');
2024-11-02 00:30:28,341 INFO sqlalchemy.engine.Engine [generated in 0.00020s] ()
INFO:sqlalchemy.engine.Engine:[generated in 0.00020s] ()
2024-11-02 00:30:28,342 INFO sqlalchemy.engine.Engine COMMIT
INFO:sqlalchemy.engine.Engine:COMMIT
INFO:httpx:HTTP Request: POST https://integrate.api.nvidia.com/v1/chat/completions "HTTP/1.1 200 OK"
PRINT OUTPUT: ** (SQL Syntax Error)

The generated SQL INSERT statement is correct, but it seems that there is an error in the execution of the query. The error message is not specific, but here are some potential issues:

* **Typo in table or column names**: Make sure that the table name "instructors" and column names "name", "email", "organization", and "exam_name" are spelled correctly and match the actual table schema.
* **Data type mismatch**: Verify that the data types of the values being inserted match the data types of the corresponding columns. For example, if the "email" column is defined as a unique identifier, inserting a string value may cause an error.
L
F
4 comments
Then you can execute the SQL however you need
Thank you! Can you suggest ways I can use INSERT that way with llamaindex?
I think the above is my suggestion? Get the generated sql, then run it with sqlalchemy or which ever library you want πŸ‘
I found a way, thank you!!!
Add a reply
Sign up and join the conversation on Discord