SQLITE¶

Logo

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files.

This documents covers how to interact with SQLITE database using our library.

Pre-requisites:

Please make sure the accessible Sqlite DB path.

Setup:

To create a sqlite connection using path

SQLITE_SQL_PATH = '<DB_PATH>'
from semantic_ai.connectors import Sqlite

file_path = f'<DB_PATH>'
sqlite = Sqlite(sql_path=file_path)
conn = await sqlite.connect_db()

To create natural language processing for normal text

from semantic_ai.nlp.prompt import Prompt

prompt = Prompt()
prompt_res = await prompt.nlp_to_sql(data_base=conn, normal_text="query")

To get answer from NLP

data = json.loads(prompt_res)
result = sql.execution(data)