Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask CRUD programming without SQLAlchemy or other ORM

I am learning Python / Flask. Now I am at the point where I am learning Flask with MySQL Database. I read lots of posts about using Flask with databases and most of them suggest to use SQLAlchemy. I tried to read about SQLAlchemy, but I didn't like that because I prefer building and executing SQL queries and creating tables in the database only. Is there any way that I can take full benefit of using Flask with MySQL Database without SQLAlchemy?

Please suggest.

like image 210
user20072008 Avatar asked Apr 23 '15 20:04

user20072008


1 Answers

You don't have to use SQLAlchemy, no. You just have to connect to the database in Flask and execute your queries manually.

This question is about how to connect to MySQL with Python, and the official docs go over creating a site with a SQLite database. Modify the examples provided there with your MySQL connection.

like image 185
Celeo Avatar answered Sep 20 '22 20:09

Celeo