English 中文(简体)
TinyDB - Environmental Setup
  • 时间:2024-12-27

TinyDB - Environmental Setup


Previous Page Next Page  

Prerequisite for TinyDB setup

To install TinyDB, you must have Python 3.6 or newer installed in your system. You can go to the pnk www.python.org 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 www.tutorialspoint.com

Instalpng 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 pnk https://pypi.org/project/tinydb/#files 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 pke 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.

Uinstalpng TinyDB

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


pip uninstall tinydb
Advertisements