Open In App

Python Database Tutorial

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Python being a high-level language provides support for various databases. We can connect and run queries for a particular database using Python and without writing raw queries in the terminal or shell of that particular database, we just need to have that database installed in our system.

Python Database Tutorial

In this tutorial, we will discuss how to Python with the most commonly used relational databases such as MySQL, SQLite, NoSQL databases like MongoDB and we will also discuss how to deal with JSON using Python with the help of good examples.

Python MySQL

Python MySQL Connector is a Python driver that helps to integrate Python and MySQL. This Python MySQL library allows the conversion between Python and MySQL data types. MySQL Connector API is implemented using pure Python and does not require any third-party library. 

Introduction

Python MySQL Queries

Note: For more information, refer to our detailed Python MySQL Tutorial

Python SQLite

Python SQLite3 module is used to integrate the SQLite database with Python. It is a standardized Python DBI API 2.0 and provides a straightforward and simple-to-use interface for interacting with SQLite databases. There is no need to install this module separately as it comes along with Python after the 2.5x version.

Introduction

Python SQLite Queries

Note: For more information, refer to our detailed Python SQLite3 Tutorial

Python JSON

JSON JavaScript Object Notation is a format for structuring data. It is mainly used for storing and transferring data between the browser and the server. Python too supports JSON with a built-in package called json. This package provides all the necessary tools for working with JSON Objects including parsing, serializing, deserializing, and many more.

Introduction

Python JSON – Reading and Writing

Parsing JSON

Python JSON – Serializing and Deserializing

Python MongoDB

MongoDB is one of the most popular NoSQL database. It is a cross-platform, object-oriented database. Basically NoSQL means MongoDB does not store data in the table or relational format rather provide a different mechanism for storage and retrieval of data. This is called BSON which is similar to JSON. That’s why MongoDB offers high speed, high availability, and high scalability.

Introduction

Python MongoDB Queries

Python MongoDB Indexing



Last Updated : 15 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads