now, we need to use a database to store and retrieve data.
in fastapi, we use sqlalchemy to connect to the database and manage data.
instead of manually connecting every time,
we will create a file to manage the database connection in advance.
this file will act as a "database client."
let’s install `sqlalchemy` inside our conda virtual environment.
then, check that the correct conda virtual environment is selected in select interpreter.
next, select reload window from the command palette, and you should see that `sqlalchemy` is installed successfully.
now, let’s define each model, which means defining the table structure.
we will define the `user`, `session`, and `detection_log` tables.
we are not certain yet,
but we will define, the `user` table to store user information,
the `session` table to store session details,
and the `detection_log` table to store fire detection data.
now, we will initialize the database in the `main.py` file.
we will add configurations to resolve any path issues.
let’s configure the settings to initialize the database.
once the configuration is complete and the server is restarted,
you should see that the `sql_app.db` file has been created.
install the `sqlite` extension.
next, open the command palette, go to the `sqlite` menu, and select open database.
select the `sql_app.db` file.
you will see a sqlite explorer tab appear in the left menu.
in this tab, you can view the created tables, their structures, and run various queries.
now, we have successfully integrated `sqlite`.