How To Use MySQL Database With Flask - Flask Fridays #9

Поділитися
Вставка
  • Опубліковано 10 вер 2024

КОМЕНТАРІ • 129

  • @Codemycom
    @Codemycom  3 роки тому +7

    ▶️ Watch Entire Flask Friday Playlist ✅ Subscribe To My UA-cam Channel:
    bit.ly/3ig2eJn bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
    ▶️ Get The Code
    bit.ly/2L1jBl5

  • @toilinginobscurity3091
    @toilinginobscurity3091 2 роки тому +4

    Sqlite is absolutely a production level database! However says otherwise doesn't understand the purpose of it. Sqlite answers the question "how do we increase the speed of the `fopen()` process". In other words, if you are constantly reading data instead of writing or transactioning, Sqlite is the answer. Nevertheless, if you try to use Sqlite as a transactional database then yes of course it's not production level. Right tool for the right job.

  • @albertusschrier7867
    @albertusschrier7867 2 роки тому +6

    pip install mysql-connector-python-rf screwed me over. I got an Authentication plugin 'caching_sha2_password' error. I deleted the installs in the venv/lib folder in Pycharm. I then installed pip install mysql-connector, and pip install mysql-connector-python. Everything worked after that.

  • @sithuhtun3609
    @sithuhtun3609 3 роки тому +8

    Your videos are the best, John. One day, I hope this channel will have everything about Python.

  • @KernelKudos
    @KernelKudos 2 роки тому +4

    I subscribed and liked the video just because of the positive energy that you gave me at the beginning of the video 😄. Good Job ! ! !

  • @gsbdrums
    @gsbdrums Рік тому +3

    Hi John When i got to the part at 10:51 i got this error
    Authentication plugin 'caching_sha2_password' is not supported
    i have no idea why

    • @Codemycom
      @Codemycom  Рік тому

      Did you try googling the error?

    • @dakoderii4221
      @dakoderii4221 Рік тому +2

      I had to uninstall mysql-connector and mysql-connector-pyhton-rf. Only mysql-connector-python worked for me. I tried them one at a time after the bulk install of all three caused the error you stated above.

  • @rastaricky9584
    @rastaricky9584 6 місяців тому

    Great tutorials! One note, I tried setting this up on AWS, using Postgres…the db.create_all(), required a db.session.commit() to finally work on AWS.

    • @Codemycom
      @Codemycom  6 місяців тому

      yeah every webhost is different

  • @kdtallllll
    @kdtallllll 11 місяців тому +2

    Do you have any videos for CRUD projects using MySQL+Flask+Python only? I don't believe I'm supposed to use connectors in my class, because we haven't learned about them yet. Awesome video!

  • @habtamus7137
    @habtamus7137 Рік тому

    I was able to solve my problem using this video. Thanks a lot.

  • @silentt2143
    @silentt2143 Рік тому

    How can I view the contents of the database? I’m trying to connect to it using a JDBC, but it’s giving me an error saying a certain table does not exist.

  • @-0-__-0-
    @-0-__-0- Рік тому

    I think this is a much better hobby for you Mr.White.

  • @timjames4306
    @timjames4306 Рік тому

    but what if i have to continue with sql lite like from college project and not for deployment. is All the step you showen is same for SQL lite ?

  • @yeet-rx8iv
    @yeet-rx8iv 3 роки тому

    Hey John I have a question about working with devise from one of your older videos (I wanted to ask you here bc this is more recent). Do you know how you can enable an admin account to edit all users with devise? I am able to retrieve a list of all users like how you would with any model, but the update action for a user does not work (I think there is no functionality in devise to allow a signed in user to edit another users acc). Do you know the proper way to do this?

  • @christianhelwig
    @christianhelwig 3 роки тому

    Thank you for this top-notch playlist

  • @ajkanya3905
    @ajkanya3905 2 роки тому

    Great videos John, keep them coming. am really enjoying them and learining alot within a short time. Thanks man! ;)

  • @jeanlisboalino
    @jeanlisboalino Рік тому +1

    Hi, before all, thx for sharing !!
    I tried first keeping all the 3 libraries installed , but it didnt work.... so o did uninstall all and installed again only mysql-connector-python

  • @emchivi5780
    @emchivi5780 2 роки тому +1

    Hi John! Thanks for your videos, question, when I ran the db in a development environment my db works fine, but when I run it with Heroku gave me the [Error 111].

    • @yomaldiaholson4577
      @yomaldiaholson4577 2 роки тому

      From what I've heard, you can't use a local dB in your project, you have to use an external one with the addons that Heroku offers. Check out John's video on uploading Flask to Heroku

  • @TheCkenny94
    @TheCkenny94 Рік тому

    Constantly getting an SQAlchemy error (1045, "Access denied for user 'root'@'localhost' (using password: YES)").
    I've read all the stack overflow and reddit threads but they're all either super complex or just "double check your password". From the MySQL workbench I can see my server is running, and the "our_users" table was created, but I cannot connect / interact.
    Any help / suggestions?

    • @Codemycom
      @Codemycom  Рік тому +1

      passwords are case sensitive, yes is different than YES and Yes.... you may think you're using the right password, but you probably arent...I'm not sure it can really be anything else

    • @TheCkenny94
      @TheCkenny94 Рік тому

      @@Codemycom Thanks for the response! I was going down so many rabbit holes last night, but with your feedback I was able to take a focused approach and fix the issue!
      You were totally right, it was a password issue. I got confused with the URI - I thought it had to be in the format :password... Removing the text "password" from my URI (as my password does not begin with these characters) resolved the issue.
      Thanks so much for your response! I've been coding along with the series and I'm learning lots and having a ton of fun :)

  • @stryker2k2
    @stryker2k2 Рік тому

    You're flawless at introducing yourself and you've got the motions memorized; including the backwards head thrust of "insanely cheap"! So, my question... now that you've done the same intro soooo many times, do you find yourself doing the introduction at night in your dreams?

    • @Codemycom
      @Codemycom  Рік тому +1

      lol wouldn't that be something

  • @wordwonders365
    @wordwonders365 2 роки тому

    Please what do I choose in the co fig type while installing MYSQL. Development, Server or Dedicated. I want to use it for an actual blog. Thanks.

  • @vikrambhojanala7662
    @vikrambhojanala7662 3 роки тому +1

    how can I add a column to the database without having to delete it entirely?

    • @Codemycom
      @Codemycom  3 роки тому

      I have videos on this playlist showing how to migrate the database

  • @swatiprasad8942
    @swatiprasad8942 2 роки тому

    how to insert data from an api request?
    suppose I want to insert data using a for loop instead of from the html page, then how to do it?

    • @Codemycom
      @Codemycom  2 роки тому

      I don't have any videos on that

  • @Ishaaq92
    @Ishaaq92 Рік тому

    at 14:20
    when I try running db.create_all() I get an error message saying:
    This typically means that you attempted to use functionality that needed
    the current application. To solve this, set up an application context
    with app.app_context(). See the documentation for more information.

    • @TURAN998
      @TURAN998 Рік тому +3

      >>>from app import db, app
      >>>from hello import db
      >>> with app.app_context():
      ... db.create_all() (this first press space button, next db.create_all())
      ... (this just press enter button)

  • @rithirongk
    @rithirongk 2 роки тому

    love it, very useful.

  • @lukashakl9297
    @lukashakl9297 2 роки тому +3

    Hi John, I love your videos. I have a problem with "db.create_all()" command. When I call this function I get error in console "....sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError)(1045, "Access denied for user 'root'@'localhost' (using password: YES)..." . Do you have experience how to solve this? With sqlite3 database code works perfect, but MYSQL make this error

  • @subijoyacharya3189
    @subijoyacharya3189 3 роки тому

    Thank you for so much value.
    Please make video on integrating Django website with Friebase.

    • @Codemycom
      @Codemycom  3 роки тому

      Sorry I don't know Firebase

  • @sudharakafernando4391
    @sudharakafernando4391 2 роки тому

    Thank you sir!!!

  • @igboanuuchenna8498
    @igboanuuchenna8498 2 місяці тому

    your video just saved me from a test 😅

    • @Codemycom
      @Codemycom  2 місяці тому

      Glad I could help!

  • @lavanyau4062
    @lavanyau4062 2 роки тому

    How to connect flask to SQLPLUS oracle 10 g???

  • @senorviglione4925
    @senorviglione4925 3 роки тому +2

    John, you have the best coding videos on UA-cam, my g. Unfortunately, I'm facing an error doing this with PyCharm (instead of Sublime and Gitbash). I've followed your steps in the video, however, I can't get the from hello import db to work when I run it in the command prompt (just for note, I named my py file 'flaski' instead of 'hello'). So, when I run from flaski import db, it says 'from' is not recognized as an internal or external command, operable program or batch file. I am on Windows and just type 'Python' in the command line to get where I need to be, instead of winpty. Everything else runs smoothly up until this point and I've installed all the modules in the Python Interpreter in my IDE as well. Thank you again for everything!

    • @BlyatifulButter
      @BlyatifulButter 2 роки тому

      are you sure you typed "python" in cmd first? because the error message "command is not recognized as an internal or external command" is only exclusive to Windows command line. In Python it would've been like "invalid syntax" or "name 'from' is not defined". Make sure you're in your app directory first (you can do this by using cd YOURDIRECTORY or type "cmd" in the search box while in your directory)

  • @Luther_Luffeigh
    @Luther_Luffeigh 3 роки тому +1

    I love your energy 🙌🏽

  • @miiihaaas
    @miiihaaas Рік тому

    4:50 what if mysql is not on local pc and it is on cPanel? What should I write instead localhost?

    • @Codemycom
      @Codemycom  Рік тому +1

      the url of the database...but there are many other steps to do first.

    • @Codemycom
      @Codemycom  Рік тому

      @@miiihaaas no

  • @universologist1941
    @universologist1941 3 роки тому

    Pretty cool. Good video

  • @jamikemichelohia2615
    @jamikemichelohia2615 3 роки тому

    Enjoyed the video. One of the reasons I like Flasks. Django uses sqlite3 as default, is there a way to change that to MySQL and at the same time using Django ORM.
    Thanks in advance

    • @Codemycom
      @Codemycom  3 роки тому

      Sure, it's relatively easy to change out databases in Django...and you always use django's ORM...no matter what database you use.

  • @b391i
    @b391i 3 роки тому

    You are the best bro :-)

  • @behzadbarati248
    @behzadbarati248 3 роки тому

    Thanks for video, could you please describe how we can use an existing database and make queries on it to show in our flask app? a real DB with multiple columns query with conditions.

    • @Codemycom
      @Codemycom  3 роки тому

      I did that in this video basically at the end..

  • @mugomuiruri2313
    @mugomuiruri2313 15 днів тому

    good

  • @MagicByIzzy
    @MagicByIzzy 3 роки тому

    Hey John! Thanks for the video! I am getting a table doesn't exist error can you help?

    • @Codemycom
      @Codemycom  3 роки тому

      Thanks for watching! Did you create the table? did you name it correctly?

    • @MagicByIzzy
      @MagicByIzzy 3 роки тому

      @@Codemycom I named it users, then I tried to make a class called post and access data from it. I'll wait for the next video and follow along. If I continue to get the error I'll let you know!

  • @DimiEG
    @DimiEG 3 роки тому

    Thanks a lot. Interesting as usual. PostgreSQL will be next I believe? ;) BTW, had problems with MSYS2, Python and iPython I prefer for interactive Python commands. iPython looks like have bugs on MSYS2. It gives errors for Python commands. If install it into CMD windows console it looks working OK. Also MSYS2 has two Pythons - one is system one and the other is MinGW based which may be confusing. My question is - why you don't use the Docker for Python development? Tnx.

    • @Codemycom
      @Codemycom  3 роки тому +1

      Why would I use Docker? From all the videos I create, it's obviously not necessary....

  • @chadwickm.2524
    @chadwickm.2524 9 місяців тому

    Are you going to talk about csrf_tokens in future videos (flask friday #10 - #44) ?

    • @Codemycom
      @Codemycom  9 місяців тому

      There's nothing to talk about with them, you simply add them to your forms, and of course we do that.

  • @mohamedmamoun1870
    @mohamedmamoun1870 3 роки тому +2

    زوولي والله يا اب صلعه

    • @SAMIGAMER44
      @SAMIGAMER44 3 роки тому

      hi John little help for you
      he says: my man baldy

    • @mohamedmamoun1870
      @mohamedmamoun1870 3 роки тому

      ​@@SAMIGAMER44​
      حبيبي ياخ سوداني؟

    • @SAMIGAMER44
      @SAMIGAMER44 3 роки тому +1

      @@mohamedmamoun1870 لا يا عين ابوي انت سعودي تشرفت فيك

    • @mohamedmamoun1870
      @mohamedmamoun1870 3 роки тому

      @@SAMIGAMER44 الشرف ليا والله الله يكرمك يا الحبيب

  • @vedantpatil5615
    @vedantpatil5615 2 роки тому

    Thanks

  • @trrt1459
    @trrt1459 Рік тому

    Access denied for user 'root'@'localhost'

    • @Codemycom
      @Codemycom  Рік тому

      what did you do differently from the video?

  • @foxi958
    @foxi958 3 роки тому +1

    Please make tutorial how to download and install kivy on android

    • @Codemycom
      @Codemycom  3 роки тому

      You don't do that

    • @foxi958
      @foxi958 3 роки тому

      @@Codemycom Why is it harmful for my device

    • @Codemycom
      @Codemycom  3 роки тому

      @@foxi958 you don't write python code on android

  • @masker1128
    @masker1128 3 роки тому

    :D, ❤ your work!

  • @Alphabet_-_
    @Alphabet_-_ 3 роки тому

    short video with a lot of knowledge

    • @Codemycom
      @Codemycom  3 роки тому +1

      I dunno, 19 minutes is pretty long ;-)

  • @sarathkumar-gq8be
    @sarathkumar-gq8be 3 роки тому

    Can you please show how to upload blob file into musql db using flask, I tried more than 4mnths

    • @Codemycom
      @Codemycom  3 роки тому +1

      sure, there's not much to it

    • @sarathkumar-gq8be
      @sarathkumar-gq8be 3 роки тому

      @@Codemycom thank you, if you done this that will be very helpful for me

  • @user-bv6lt1ib8n
    @user-bv6lt1ib8n 3 роки тому

    good!

  • @trevortheresabrewster2672
    @trevortheresabrewster2672 2 роки тому

    totally sucked! had an @ in my password and was picked up as part of the address...resigned to reinstalling mysql

  • @MatthewLeach
    @MatthewLeach Рік тому

    Everyone says python is easy, intuitive. I believe it borrows from Java in that it can be quite a pain in the bottom.

    • @Codemycom
      @Codemycom  Рік тому +1

      Not really...it's pretty simple and straight forward whereas Java was spawned in the lower depths of hell ;-)

  • @Celestialzzz
    @Celestialzzz 3 роки тому +1

    I followed your code exactly, but when I try to run create.db.py like you did I get a traceback: mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported. I've looked through the documentation and stack overflow, but I can't get it to work.

    • @Codemycom
      @Codemycom  3 роки тому +1

      Give this a read:
      stackoverflow.com/questions/50557234/authentication-plugin-caching-sha2-password-is-not-supported
      Or it could be you need to use a different MySQL connector

    • @Celestialzzz
      @Celestialzzz 3 роки тому +2

      @@Codemycom Hey, thanks for the thoughtful reply, and for this god-send of a series! I found that stack overflow page in my initial googling, and nothing in there fixed it. What I eventually had to do was manually install the most recent update with "pip install mysql-connector-python==8.0.17".
      If anyone else runs into the same issue I hope that helps. Also once again, thank you for the tutorials. I love your style. How you move quickly over the material so I don't have to slog through long content to get the answers I need is perfect! I am happily subscribed.

  • @TppJay
    @TppJay Рік тому

    From hello import db , hello not found

    • @Codemycom
      @Codemycom  Рік тому

      sounds like you didn't name your file hello.py

  • @44wpwojtek44
    @44wpwojtek44 2 роки тому

    these connectors threw me off my chair. why the hell there has to be such insanity? i would not have been able to figure it out without u, jeez.

    • @Codemycom
      @Codemycom  2 роки тому

      Ha yeah...glad you got it sorted out

  • @armeng4802
    @armeng4802 2 роки тому

    With macs you need rootroot

  • @histavista8146
    @histavista8146 2 роки тому

    Please make a migration video sqlite to mysql, sqlite to postgresql

    • @Codemycom
      @Codemycom  2 роки тому

      I've done videos on all of those.

  • @user-iy2ln6rp9n
    @user-iy2ln6rp9n 2 роки тому +1

    say my name

  • @alapatijayanth1597
    @alapatijayanth1597 5 місяців тому

    things walter white is doing these days for a living

  • @universologist1941
    @universologist1941 3 роки тому

    I thought Walter White started a UA-cam Channel

  • @asgharabbasi2947
    @asgharabbasi2947 2 роки тому +1

    so problematic and not for beginners

    • @Codemycom
      @Codemycom  2 роки тому +2

      incorrect

    • @trrt1459
      @trrt1459 Рік тому

      @@Codemycom Access denied for user 'root'@'localhost'