
In this step, you’ll install the necessary packages, and set up your Flask application, the Flask-SQLAlchemy database, and the employee model that represents the employee table where you’ll store your employee data. Step 1 - Setting up the Database and Model See How to Use Flask-SQLAlchemy to Interact with Databases in a Flask Application for background knowledge. You can review our How To Build a Website with HTML tutorial series for background knowledge.Īn understanding of basic Flask-SQLAlchemy concepts, such as setting up a database, creating database models, and inserting data into the database. If you are not familiar with Flask, check out How to Create Your First Web Application Using Flask and Python and How to Use Templates in a Flask Application.Īn understanding of basic HTML concepts. In this tutorial we’ll call our project directory flask_app.Īn understanding of basic Flask concepts, such as routes, view functions, and templates. Follow the tutorial for your distribution in How To Install and Set Up a Local Programming Environment for Python 3 series. PrerequisitesĪ local Python 3 programming environment. Finally, you’ll use pagination to display a certain number of employees per page in a web application. You’ll order the results by a column value, and count and limit query results. You’ll retrieve employees’ records on certain conditions, such as getting only active employees or getting a list of out-of-office employees. You’ll use the Flask shell to query a table, and get table records based on a column value (for example, an email).


Each employee will have a unique ID, a first name, a last name, a unique email, an integer value for their age, a date for the day they joined the company, and a boolean value to determine whether an employee is currently active or out of office. In this tutorial, you’ll use Flask and Flask-SQLAlchemy to create an employee management system with a database that has a table for employees.

Flask-SQLAlchemy is a Flask extension that makes using SQLAlchemy with Flask easier, providing you tools and methods to interact with your database in your Flask applications through SQLAlchemy. And it also gives you an Object Relational Mapper (ORM), which allows you to make queries and handle data using simple Python objects and methods. It gives you access to the database’s SQL functionalities. It provides ways to interact with several database engines such as SQLite, MySQL, and PostgreSQL. SQLAlchemy is an SQL toolkit that provides efficient and high-performing database access for relational databases. Introductionįlask is a lightweight Python web framework that provides useful tools and features for creating web applications in the Python Language. The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program.
