Connecting to a MySQL Database in Flask Using Flask-MySQLDB

  Рет қаралды 61,097

Pretty Printed

Pretty Printed

Күн бұрын

Пікірлер: 63
@prettyprinted
@prettyprinted 4 жыл бұрын
Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql
@لنتسقطامةرسولهامحمدوصاحبهعمرال
@لنتسقطامةرسولهامحمدوصاحبهعمرال 4 жыл бұрын
you are a genie for flask teaching.......nobody in all youtube can manipulate flask than you.......god bless you Sir and many thanks for your time and your light = learning
@Indikul
@Indikul 3 жыл бұрын
I am very new to flaks and I'm creating a docker image with flaks app and mysql. I spend two whole days trying to connect these two containers with me lack of knowledge. Must have gone through hundreds to ways to connect these two. You video helped me a lot and super simple explanations. Thanks a million.
@sivakumaranbazhagan1672
@sivakumaranbazhagan1672 2 жыл бұрын
Man, this SQL alchemy was way too complicated for a novice and there isn't enough info out there in the web to teach this stuff so simple and upto poin. Really a great job putting this info out for us.
@XadaiSantos
@XadaiSantos 4 жыл бұрын
Amazingly simple, straightforward video! Great job, really great
@TommiSvaerd
@TommiSvaerd 5 жыл бұрын
Omg i needed this video last week, was stuck for 3 days with not being able to add the data to the db. However great video, and i learned about the cursor class :)
@Taridonov
@Taridonov 4 жыл бұрын
Ive seen lots of manuals and videos about flask+mysql, but yours is the most informative and clear. br< thank you VERY MUCH!
@prettyprinted
@prettyprinted 4 жыл бұрын
You're welcome!
@axelamefia5791
@axelamefia5791 2 жыл бұрын
Thank you friend, this helped me.
@run4ever102
@run4ever102 Жыл бұрын
You saved my butt! Thanks man!
@Anshegar
@Anshegar 5 жыл бұрын
Important : if you can't install "flask-mysqldb", then you need "mysqlclient" and some time you cant install even "mysqlclient" , then you need install "weel mysqlclient" from here - www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient Thanks for lesson!
@rubychandra5339
@rubychandra5339 3 жыл бұрын
Thanks, very simple and easy to use for basic learning
@omarelsebaey9589
@omarelsebaey9589 2 жыл бұрын
that's brilliant to the point and it helped a lot
@sivakumaranbazhagan1672
@sivakumaranbazhagan1672 2 жыл бұрын
for those using ubentu, if mysqlclient does not get installled via pip, try this ....sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
@tusharpathade9914
@tusharpathade9914 3 жыл бұрын
Hey, nice video 👍. I have MySQL database locally on machine. Can you please tell how to config app then. I runs MySQL as sudo mysql from commandline
@ryanbiztech9181
@ryanbiztech9181 3 жыл бұрын
Note that if you are using version control for your project such as a public Github repository, you should save sensitive data configurations such as passwords and keys in an instance folder which is automatically ignored by .gitignore.
@quianoherminigildojra.4989
@quianoherminigildojra.4989 3 жыл бұрын
nice explanation, I get it already.
@shubhamd1706
@shubhamd1706 5 жыл бұрын
Thanks a Lot man!!! Perfectly Explained
@prettyprinted
@prettyprinted 5 жыл бұрын
You're welcome! Thanks for watching.
@danielfaller5617
@danielfaller5617 3 жыл бұрын
"... Ill leave a description in the link below" lmao 0:41
@suharsh96
@suharsh96 4 жыл бұрын
Can you do a video on connecting mysql with sqlalchemy? Thanks
@MrArdo-branch-main
@MrArdo-branch-main 4 жыл бұрын
Kami-Sama Thank you Very Much....my company said i should learn back-end and i don't know how and where to start..i heard they using mysql instead of sqlalchemy..
@noahbroyles8828
@noahbroyles8828 4 жыл бұрын
Great video! Interested to see how this would be done in a flask application with multiple .py files and blueprints
@yanafinn
@yanafinn 4 жыл бұрын
how do you update the data in flask form?
@thealwayshungryjimmy9999
@thealwayshungryjimmy9999 4 жыл бұрын
@pretty printed, what if i have a column in innodb mysql that is called reportID and i needed it to auto increment?
@phildeman7905
@phildeman7905 3 жыл бұрын
Can the mysql configuration be place in a file with any name (ie: mysqlconfig.py) or must this be added to an already existing routes.py file? Also, you set the MYSQL_CURSORCLASS to DictCursor, yet the results in your example came back as a tuple. How do I get the results returned as a list?
@123cookies4life345
@123cookies4life345 5 жыл бұрын
Hi Anthony! What is the best way to pass the results of a query to a jscript file referenced in a html-template?
@ferooyahya4138
@ferooyahya4138 4 жыл бұрын
can i do this dynamically? for example, for every student logs in and do some actions, a table will be fill in with all student details? is it possible? and thanks for this great video!!
@harshilshah8983
@harshilshah8983 2 жыл бұрын
Hey, I have created a flask app that has a simple form where you give your name and job role and submit. The output will be directed to another route and displayed on webpage. But now I also want to add Microsoft SQL server in middle that will store the values of form and still give the output on website. I will be using SQL server authentication. I have successfully tried it without form or creating routes. Like manually storing data in SQL server using flask sqlalchemy. But when I use forms and create routes, than I get stuck.
@jyotimehra469
@jyotimehra469 3 жыл бұрын
How can we use this for prepared statements in mysql?
@TashieTash
@TashieTash 4 жыл бұрын
such a great video, it definitely helped me out.
@ajaykumark107
@ajaykumark107 5 жыл бұрын
Great tutorials!! Just discovered your channel. Do you have more videos on My SQL topic? Which is better among MySQL & SQLLite?
@prettyprinted
@prettyprinted 5 жыл бұрын
I don't cover SQL directly much on this channel. I like sqlite more for my projects to keep things simple, but I've used MySQL as well, and it has worked fine for me.
@regnartek
@regnartek 4 жыл бұрын
Ecellent Video
@merchaouiaymen8917
@merchaouiaymen8917 3 жыл бұрын
How can we retrieve the tuples into vuejs ?
@goodmusic284
@goodmusic284 5 жыл бұрын
Thanks! Can you please show me how to deploy this to heroku?
@caramessina9593
@caramessina9593 5 жыл бұрын
I would also like this! I am able to access the SQL DB on my local server, but when I try to access the DB on Heroku, I keep getting the "Internal Server Error."
@goodmusic284
@goodmusic284 5 жыл бұрын
@@caramessina9593 i am still stuck. I deployed it on a Ubuntu webserver instead. Please post a tutorial here if you figured it out.
@caramessina9593
@caramessina9593 5 жыл бұрын
@@goodmusic284 I think I figured it out! So on Heroku, you have to create a DB within Heroku. You can do this once you login into your app by going to "resources" and then in the search box doing "MYSQL." ClearDB MySQL should come up, which is what I am using. Then, once you have that database created on your Heroku account, go to the "Settings" and "Reveal Config Vars." It will give you a url that looks like this: mysql://letters123:letters456@us-cdbr-iron-east-05.cleardb.net/heroku_letters123?reconnect=true (except the "letters123" will be unique for your DB). You then enter in on your Flask app that information. Host: us-cdbr-iron-east-05.cleardb.net Database: heroku_letters123 username: letters123 password: letters456 It also wasn't working for me, and I realized I needed a secret key. I added this to my app.py file: app.secret_key = "mysecretkey" (except make it your own secret key). I hope that's helpful! OH you can also dump an already-existing MySQL database into the heroku database. I don't know how, but you can probably find an online tutorial.
@satyamuralidharpeddireddi6192
@satyamuralidharpeddireddi6192 5 жыл бұрын
i have executed it locally it will work while iam creating same code into docker images it will show like #cur = MySQL.connect() getting error
@mp3311
@mp3311 4 жыл бұрын
Should I use Flask SQLAlchemy instead? Is mysql offering the same functionality for a flask application as sqlAlchemy?
@anmolsingh4969
@anmolsingh4969 4 жыл бұрын
Orm bro
@LGseeker
@LGseeker 5 жыл бұрын
I am getting this erorr *Instance of 'MySQL' has no 'connection' member pylint(no member) [19, 11]*
@mitchellsotelo2696
@mitchellsotelo2696 5 жыл бұрын
just replace: cur = mysql.get_db().cursor()
@sebastiancastillo3560
@sebastiancastillo3560 5 жыл бұрын
Oh Yes! Thanks Anthony !!
@misterp8128
@misterp8128 5 жыл бұрын
ModuleNotFoundError: No module named 'MySQLdb' any idea why I get this error?
@tylermitchell185
@tylermitchell185 4 жыл бұрын
I may be a little late, but just in case try "pip install [module name]" in the windows command prompt everytime you get an error similar to this
@BaconBitsJuice
@BaconBitsJuice 2 жыл бұрын
"I'll leave a description in the link below" lol fucking fantastic guide though!
@mohammedkastali7096
@mohammedkastali7096 2 жыл бұрын
how can i delete record please
@ferooyahya4138
@ferooyahya4138 4 жыл бұрын
okay, i tried to do (from flask_mysqldb import MySQL) but gives me error cuz i don't have the package, i tried some workaround like pip3 install flask-mysql pip install MySQL-Python but nothing happened really! it also gives me (ConfigParser) error and tried different solutions. it also gives me (mysql_config not found). I am completely lost and don’t know how to fix these errors. I’d appreciate your help!
@anmolsingh4969
@anmolsingh4969 4 жыл бұрын
Python 3x version not support mysql db I have same problem
@deadshot4888
@deadshot4888 5 жыл бұрын
Access denied for user 'root@localhost' (using password:NO) I am using workbench. please help
@vishalipalav4518
@vishalipalav4518 5 жыл бұрын
Thank you
@asthasingh8051
@asthasingh8051 5 жыл бұрын
How to delete an entry made in database ? I am jot able to delete the data entered
@tanishq2766
@tanishq2766 5 жыл бұрын
go for freecodecamp.org mysql tutorial....mysql is an pretty easy language to learn! One day would be enough to learn imo :)
@shardulkulkarni1008
@shardulkulkarni1008 4 жыл бұрын
how to hide password while adding this code in production?
@pieterwaters8450
@pieterwaters8450 3 жыл бұрын
is it just me or did he say check the description in the link at 0:42 lol.. thanks for the great vid tho
@sivakumaranbazhagan1672
@sivakumaranbazhagan1672 2 жыл бұрын
But dude, why triple quotes for sql statements?
@amycai3867
@amycai3867 4 жыл бұрын
I got error when I try to install mysqldb with command: pip install flask-msqldb Error: error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2 Anyone have same problem? Please help to give solution if you fixed it already. Thanks!
@JonNordland
@JonNordland 4 жыл бұрын
I have same problem... Have not found a solution.
@myrongrade6420
@myrongrade6420 4 жыл бұрын
@@JonNordland This may be due to the incorrect version of Python installed. Make sure you have installed 64bit if your machine is 64bit and 32bit if 32. I was having the same error and once I redownloadedd python and left the install in its default location I was not getting the error anymore
@mxd8
@mxd8 5 жыл бұрын
is this good for a local db, lulz
@prettyprinted
@prettyprinted 5 жыл бұрын
Yeah, you can have a local MySQL database.
Deploying Flask Apps Using Python Anywhere
12:11
Pretty Printed
Рет қаралды 83 М.
Python Flask with MySQL Database
22:51
The Programmer in You
Рет қаралды 153 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 98 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 36 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Intro to Flask-Login
16:54
Pretty Printed
Рет қаралды 78 М.
How to Use Databases With SQLAlchemy  - Flask Fridays #8
25:36
Codemy.com
Рет қаралды 97 М.
Connecting to a Database in Flask Using Flask-SQLAlchemy
6:56
Pretty Printed
Рет қаралды 97 М.
An Example of Celery in a Flask App With Multiple Files
15:40
Pretty Printed
Рет қаралды 22 М.
7 Database Paradigms
9:53
Fireship
Рет қаралды 1,6 МЛН
Python Flask Authentication Tutorial - Learn Flask Login
29:35
Arpan Neupane
Рет қаралды 236 М.
SQLAlchemy: The BEST SQL Database Library in Python
16:39
ArjanCodes
Рет қаралды 87 М.
How To Use MySQL Database With Flask - Flask Fridays #9
19:00
Codemy.com
Рет қаралды 122 М.
Build your first REST API with Flask and PostgreSQL
27:42
teclado
Рет қаралды 72 М.
Getting Started With Flask-SQLAlchemy
15:27
Pretty Printed
Рет қаралды 90 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 98 МЛН