Khóa học miễn phí TinyDB – Environmental Setup nhận dự án làm có lương

TinyDB – Environmental Setup



Prerequisite for TinyDB setup

To install TinyDB, you must have Python 3.6 or newer installed in your system. You can go to the link and select the latest version for your OS, i.e., Windows and Linux/Unix. We have a comprehensive tutorial on Python, which you can refer at

Installing TinyDB

You can install TinyDB in three different ways: using the Pack Manager, from its Source, or from GitHub.

Using the Package Manager

The latest release versions of TinyDB are available over both the package managers, pip and conda. Let us check how you can use them to install TinyDB −

To install TinyDB using pip, you can use the following command −

pip install tinydb

To install TinyDB via conda-forge, you can use the following command −

conda install -c conda-forge tinydb

From Source

You can also install TinyDB from source distribution. Go to link to download the files and building it from source.

From GitHub

To install TinyDB using GitHub, grab the latest development version, unpack the files, and use the following command to install it −

pip install

Setting up TinyDB

Once installed, use the following steps to set up the TinyDB database.

Step 1: Import TinyDB and its Query

First, we need to import TinyDB and its Query. Use the following command −

from tinydb import TinyDB, Query

Step 2: Create a file

TinyDB database can store data in many formats like XML, JSON, and others. We will be creating a JSON file by using the following file −

db = TinyDB(''Leekha.json'')

The above command will create an instance of TinyDB class and pass the file Leekha.Json to it. This is the file where our data will be stored. Now, the TinyDB database set up is ready, and you can work on it. We can now insert data and operate the value in the database.

Uinstalling TinyDB

If in case you need to uninstall TinyDB, you can use the following command −

pip uninstall tinydb

Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc