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

Sdílet
Vložit
  • čas přidán 6. 09. 2024

Komentáře • 129

  • @Codemycom
    @Codemycom  Před 3 lety +7

    ▶️ Watch Entire Flask Friday Playlist ✅ Subscribe To My CZcams 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

  • @albertusschrier7867
    @albertusschrier7867 Před 2 lety +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.

  • @toilinginobscurity3091
    @toilinginobscurity3091 Před 2 lety +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.

  • @sithuhtun3609
    @sithuhtun3609 Před 3 lety +8

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

  • @KernelKudos
    @KernelKudos Před 2 lety +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 ! ! !

  • @kdtallllll
    @kdtallllll Před 11 měsíci +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!

  • @gsbdrums
    @gsbdrums Před rokem +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  Před rokem

      Did you try googling the error?

    • @dakoderii4221
      @dakoderii4221 Před rokem +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 Před 6 měsíci

    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  Před 6 měsíci

      yeah every webhost is different

  • @habtamus7137
    @habtamus7137 Před rokem

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

  • @jeanlisboalino
    @jeanlisboalino Před rokem +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

  • @-0-__-0-
    @-0-__-0- Před rokem

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

  • @stryker2k2
    @stryker2k2 Před rokem

    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  Před rokem +1

      lol wouldn't that be something

  • @ajkanya3905
    @ajkanya3905 Před 2 lety

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

  • @christianhelwig
    @christianhelwig Před 3 lety

    Thank you for this top-notch playlist

  • @senorviglione4925
    @senorviglione4925 Před 3 lety +2

    John, you have the best coding videos on CZcams, 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 Před 2 lety

      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)

  • @silentt2143
    @silentt2143 Před rokem

    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.

  • @yeet-rx8iv
    @yeet-rx8iv Před 3 lety

    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?

  • @timjames4306
    @timjames4306 Před rokem

    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 ?

  • @emchivi5780
    @emchivi5780 Před 2 lety +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 Před 2 lety

      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

  • @jamikemichelohia2615
    @jamikemichelohia2615 Před 3 lety

    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  Před 3 lety

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

  • @vikrambhojanala7662
    @vikrambhojanala7662 Před 3 lety +1

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

    • @Codemycom
      @Codemycom  Před 3 lety

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

  • @behzadbarati248
    @behzadbarati248 Před 3 lety

    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  Před 3 lety

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

  • @subijoyacharya3189
    @subijoyacharya3189 Před 3 lety

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

  • @chadwickm.2524
    @chadwickm.2524 Před 9 měsíci

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

    • @Codemycom
      @Codemycom  Před 9 měsíci

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

  • @Ishaaq92
    @Ishaaq92 Před rokem

    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 Před rokem +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)

  • @DimiEG
    @DimiEG Před 3 lety

    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  Před 3 lety +1

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

  • @rithirongk
    @rithirongk Před 2 lety

    love it, very useful.

  • @igboanuuchenna8498
    @igboanuuchenna8498 Před měsícem

    your video just saved me from a test 😅

  • @wordwonders365
    @wordwonders365 Před 2 lety

    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.

  • @lavanyau4062
    @lavanyau4062 Před 2 lety

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

  • @universologist1941
    @universologist1941 Před 3 lety

    Pretty cool. Good video

  • @sudharakafernando4391
    @sudharakafernando4391 Před 2 lety

    Thank you sir!!!

  • @MagicByIzzy
    @MagicByIzzy Před 3 lety

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

    • @Codemycom
      @Codemycom  Před 3 lety

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

    • @MagicByIzzy
      @MagicByIzzy Před 3 lety

      @@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!

  • @b391i
    @b391i Před 3 lety

    You are the best bro :-)

  • @lukashakl9297
    @lukashakl9297 Před 2 lety +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

  • @swatiprasad8942
    @swatiprasad8942 Před 2 lety

    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  Před 2 lety

      I don't have any videos on that

  • @TheCkenny94
    @TheCkenny94 Před rokem

    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  Před rokem +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 Před rokem

      @@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 :)

  • @Luther_Luffeigh
    @Luther_Luffeigh Před 3 lety +1

    I love your energy 🙌🏽

  • @foxi958
    @foxi958 Před 3 lety +1

    Please make tutorial how to download and install kivy on android

    • @Codemycom
      @Codemycom  Před 3 lety

      You don't do that

    • @foxi958
      @foxi958 Před 3 lety

      @@Codemycom Why is it harmful for my device

    • @Codemycom
      @Codemycom  Před 3 lety

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

  • @mohamedmamoun1870
    @mohamedmamoun1870 Před 3 lety +2

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

    • @SAMIGAMER44
      @SAMIGAMER44 Před 3 lety

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

    • @mohamedmamoun1870
      @mohamedmamoun1870 Před 3 lety

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

    • @SAMIGAMER44
      @SAMIGAMER44 Před 3 lety +1

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

    • @mohamedmamoun1870
      @mohamedmamoun1870 Před 3 lety

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

  • @miiihaaas
    @miiihaaas Před rokem

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

    • @Codemycom
      @Codemycom  Před rokem +1

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

    • @Codemycom
      @Codemycom  Před rokem

      @@miiihaaas no

  • @trrt1459
    @trrt1459 Před rokem

    Access denied for user 'root'@'localhost'

    • @Codemycom
      @Codemycom  Před rokem

      what did you do differently from the video?

  • @TppJay
    @TppJay Před rokem

    From hello import db , hello not found

    • @Codemycom
      @Codemycom  Před rokem

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

  • @masker1128
    @masker1128 Před 3 lety

    :D, ❤ your work!

  • @mugomuiruri2313
    @mugomuiruri2313 Před 11 dny

    good

  • @armeng4802
    @armeng4802 Před 2 lety

    With macs you need rootroot

  • @sarathkumar-gq8be
    @sarathkumar-gq8be Před 3 lety

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

    • @Codemycom
      @Codemycom  Před 3 lety +1

      sure, there's not much to it

    • @sarathkumar-gq8be
      @sarathkumar-gq8be Před 3 lety

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

  • @vedantpatil5615
    @vedantpatil5615 Před 2 lety

    Thanks

  • @histavista8146
    @histavista8146 Před 2 lety

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

    • @Codemycom
      @Codemycom  Před 2 lety

      I've done videos on all of those.

  • @user-bv6lt1ib8n
    @user-bv6lt1ib8n Před 3 lety

    good!

  • @Alphabet_-_
    @Alphabet_-_ Před 3 lety

    short video with a lot of knowledge

    • @Codemycom
      @Codemycom  Před 3 lety +1

      I dunno, 19 minutes is pretty long ;-)

  • @44wpwojtek44
    @44wpwojtek44 Před 2 lety

    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  Před 2 lety

      Ha yeah...glad you got it sorted out

  • @trevortheresabrewster2672

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

  • @MatthewLeach
    @MatthewLeach Před rokem

    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  Před rokem +1

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

  • @user-iy2ln6rp9n
    @user-iy2ln6rp9n Před 2 lety +1

    say my name

  • @universologist1941
    @universologist1941 Před 3 lety

    I thought Walter White started a CZcams Channel

  • @alapatijayanth1597
    @alapatijayanth1597 Před 5 měsíci

    things walter white is doing these days for a living

  • @asgharabbasi2947
    @asgharabbasi2947 Před 2 lety +1

    so problematic and not for beginners

    • @Codemycom
      @Codemycom  Před 2 lety +2

      incorrect

    • @trrt1459
      @trrt1459 Před rokem

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

  • @Celestialzzz
    @Celestialzzz Před 3 lety +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  Před 3 lety +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 Před 3 lety +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.