From the course: Effective Serialization with Python

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

SQL

SQL - Python Tutorial

From the course: Effective Serialization with Python

Start my 1-month free trial

SQL

- [Male] SQL is the language query relation of database. It practically invented the notion of schema, and has a wide variety of types. Python comes with a built-in sqlite3 model, which provides an embedded SQL. Sqlite3 is one the the most popular database out there. If you're using a web browser, or have it on a phone, you're using sqlite. I've used sqlite in several projects. You can push a lot of data quickly to a database and copy it over. It's just a single file. Let's have a look. Here is schema.sql. We define the schema of the data. We define a table, called logs, which has three columns: a time which is a timestamp, a level which is a text up to 32 characters, and a text which is a message with unbothered size. And let's see how we work with this schema. So, let's have a look at logs.py. We import sqlite3, and we're going to use then random model to generate some random data. So first we're going…

Contents