April 2018
Beginner
340 pages
7h 54m
English
Inside your server folder (not the new conversations folder), create a file named conversation.py. This will hold a class of the same name, which handles the sqlite side of creating and interacting with these databases:
import sqlite3class Conversation: def __init__(self, database): self.database = database
This looks much like the __init__ method of our Database class, but it will have its SQLite database filename passed to it, allowing this class to work with multiple different conversation databases.
The first method we will need to write is one that will create the table inside the database:
def initialise_table(self): sql = "CREATE TABLE conversation (author text, message text, date_sent text)" conn = ...