Skip to content

Tri 2: Tech Talk Week 2: SQLite Database Intro

suneelanaidu edited this page May 11, 2022 · 1 revision

This Tech Talk will focus on creating an SQLite Database using SQLAlchemy framework.

Model. The foundations of database are defining a Table and building Create, Read, Update Delete (CRUD) operations.

  • A "Table" is a Data Structure within a Database.
  • A "Table" definition in Python/SQLAlchemy is manifested with a "Class" in Python.
  • A Class is the combination of many data structures (ie list + dictionary),
  • A Class has many Functions (see def indents inside Python Class
  • A Class inherits code and functionality of packages (see class Users(db.Model)).

Review this code to understand concepts so far...

  1. Model Defining the Table Class
  2. Model Testing and Initial Setup
  3. Model Defining function to support CRUD operations
  4. Control Methods for Create, Read, Update, Delete or Alternative CRUD API definitions
  5. View Here is a runtime showing off some CRUD. All the MVC code is show at the bottom of this page.

To get started with databases, perhaps you can simply try to get some Database Code running in your project. Then you could try to define a new Table in you database. After pulling code, you will need to Init your database and table by running the Tester Method.

Flask SQLAlchemy reference

Clone this wiki locally