What is Concept Store?

What is Concept Store?

Concept Store is part of SMAQ Library where you can teach SMAQ about your business and data. The more you teach SMAQ, the better it can answer your questions.

Example

Here we demonstrate how concept store can enable SMAQ to translate the following question:

## Question: Number of male customer in our customer base
## Correct SQL: 
SELECT COUNT(*) FROM customer WHERE gender='M'

Translate without knowledge

When SMAQ translate directly based on the data schema, it has assumed that gender stores male and female in the database. However, the truth is MF! Here is the prompt

You will only have access to the following table schema:

Schema definitions:
'customer': 'customer(dob,phone,status,firstName,created_at,membership,region,lastName,gender,customer_id,email,address,district)',

Given the input question, create ONE syntactically correct {dialect} query to run. Only return the query string

Question: Number of male customer in our customer base
Query goes here:
SELECT COUNT(*) FROM customer WHERE gender='male'
## Valid query but return 0 (wrong answer)

Translate with concepts

Now, we perform an RAG with the knowledge base, which takes into the account of the meta data of the table. Since the meta data has example values, hence, our final prompt contains information about male is M in the table

You will only have access to the following table schema:

Schema definitions:
'customer': 'customer(dob,phone,status,firstName,created_at,membership,region,lastName,gender,customer_id,email,address,district)',

Concepts:
Gender: M, F

Given the input question, create ONE syntactically correct {dialect} query to run. Only return the query string

Question: Number of male customer in our customer base
Query goes here:
SELECT COUNT(*) FROM customer WHERE gender='M'
## Valid query but return 3,123 (correct!)

Voila! That’s a simple example on how useful concept store is. In real life, there are specific domain knowledge such as industry jargons and product descriptions. These are very useful in making sure SMAQ can pull the right data for you!

Last updated