Skip to content

Here, a study has been made on how to write data to the database in a simple way with FastAPI, and SQLModel

Notifications You must be signed in to change notification settings

ahmtcnbs/IntroSQLModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to SQLModel

Here, a study has been made on how to write data to the database in a simple way with FastAPI, and SQLModel

SQLModel

SQLModel is a library for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.

    $ pip install sqlmodel

SQL Table

First, I create a table called a train. This table will contain the following columns.

  • id
  • fullname
  • age
  • gender

and it contains sample data as below.

id fullname age gender
1 Deadpond 24 Male
2 Spider-Boy 36 Male
3 Rusty-Man 27 Male

Using a form written in HTML, we write the data we receive from the user to the database with a very short code. The data entered in the form will be written to our database via FastAPI.

Ekran Resmi 2021-09-10 19 53 50

To access the codes of the html form: Click Here

For database write operation and api: Click Here

For an introduction to databases, SQL, and everything else, see the SQLModel documentation.

About

Here, a study has been made on how to write data to the database in a simple way with FastAPI, and SQLModel

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published