Find answers from the community

Updated 11 months ago

hey guys, i followed perfectly examples

hey guys, i followed perfectly examples for llama_index.. im using 2 tables and i add them to metadata and mapping such as :

sql_database = SQLDatabase(engine, include_tables=all_table_names)
table_node_mapping = SQLTableNodeMapping(sql_database)
table_schema_objs = []

for table_name in all_table_names :
table_schema_objs.append(SQLTableSchema(table_name=table_name, context_str=table_contexts[table_name]))

obj_index = ObjectIndex.from_objects(
table_schema_objs,
table_node_mapping,
VectorStoreIndex,
)
query_engine = SQLTableRetrieverQueryEngine(
sql_database,
obj_index.as_retriever(similarity_top_k=1),
service_context=service_context
)

my question is, it seems the query result will NEVER do an inner join like if I ask give me the sales by customer and fromwhich state are they in .. it wont find the answer, the state is of course if the table customer.. is it me or it never joins table?
L
M
11 comments
Since you have the top-k=1, it's only ever retrieving one table
that might be why
but have you ever saw a query result with an inner join ?!
Im just confused as wheter maybe its because of this SQLTableRetrieverQueryEngine im using.. do you know if that only reads 1 table ..?
ill try with k=2
try with k=2 (or higher), see how it goes
it did a inner join wow i put 3
but hold on.. does that mean the more tables it reads the more i should put higher? i tried to read on that but internet is very limited
so it's just retrieving the most similar tables to the query. There is some limit in terms of context window, but I doubt most queries will ever need more than... 5 tables?
True yes,
hey by the way, i find he has a toff time to do more then just “SUM” exmaple asking what is the percentage of sales of division A compared to the rest of divisions

he seems not able to do the math
is there anything you know that can help?
Add a reply
Sign up and join the conversation on Discord