Find answers from the community

Updated 4 months ago

Can't generate DDL using SQLDatabase

At a glance

The community member is experiencing an issue with the SQLDatabase class from the LLaMA Index library, where they are getting a CompileError when trying to display table information. The error message indicates that the request_data column in the company_erp_instance_data_requests table is of type NullType, and the community member notes that this column stores XML data.

Another community member responds that the issue may be related to SQLAlchemy and XML column types, and suggests the community member review the source code for the SQLDatabase class in the LLaMA Index and LangChain libraries for more information.

The community member expresses appreciation for the response.

Useful resources
is there a detailed documentation for SQLDatabase?

I used the command:
sql_database = SQLDatabase(engine)

But when i display table info:
sql_database.table_info

I get the following error:
CompileError: (in table 'company_erp_instance_data_requests', column 'request_data'): Can't generate DDL for NullType(); did you forget to specify a type on this Column?

PS: this column stores xml.

any suggestions?
L
p
2 comments
tbh I have no idea πŸ˜… Its a light wrapper around lanhchain SQLDatabase object. Maybe it's an issue with SQLAlchemy and XML column types?

You can read the source code for both here
https://github.com/jerryjliu/llama_index/blob/main/llama_index/langchain_helpers/sql_wrapper.py


https://github.com/hwchase17/langchain/blob/master/langchain/sql_database.py
Thanks Logan! Much appreciated!
Add a reply
Sign up and join the conversation on Discord