How to Use Flask-SQLAlchemy With Flask Blueprints

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 100

  • @alantchunay
    @alantchunay 11 місяців тому +4

    Friend, I don't even speak your language, I'm using Google Translate just to say thanks. Because I had problems with the blueprint with sqlchemy and your video helped me perfectly, thank you very much!

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

    sir, Ive been searching the whole internet and this is exactly what Ive been looking for.... Thanks a lot for creating such a amazing video

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

    Very good and helpful video! This addressed exactly the issues I was having with circular imports.
    Thank you!

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

    Thanks dude. I don't even wanna know how much I've wasted time for trying to solve this alone. This was an answer all to my problems. Cheers!

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

    You taught me how to use flask

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

    Amazing videos as usual!
    You should create a video on testing Flask apps with pytest and how to use logging with flask so when it crashes you get an email and know exactly what went wrong.
    These tutorials will make a great contribution to your already awesome collection.

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

    Your tutorials on Flask are amazing! I am going to have to save up my pennies so that I can use your mentoring services. Great video!

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

    Dammm bro, you are really good at explainings things and going to the point, and why certain thing goes where it goes, not just typing it and let the viewer figure it out, thanks a lot for that.

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

    Soo clean

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

    Thank you so much sir for this awesome tutorial. I was struggling with it since a while now. Finally google recommended your video and my issues are resolved. A huge thanks ❤️

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

    You are especially good at these python tutorials

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

    Was Looking for File Directory Method. Thank You!!!!

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

    Thanks for sharing this. It was very helpful. I did get stuck however at the steps at 7:00 (python statements to run create_all(app). Turns out that flask-sqlalchemy was updated to remove that method which accepts the application as a parameter. To do this now, you need to call
    with app.app_context():
    db.create_all()"
    The rest of it worked just fine. Thanks again for putting this together!

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

      Hello.can you please tell me more details about this bug? Where and when should I input those code you mentioned above? Thanks!

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

      @@kelvinyeung3394 still waiting on this ;)

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

      Any solution ?

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

      I put it in the create_app() function towards the bottom of the function. It’s in the top level __init__.py file. Hope that’s helpful. Sorry for the delay

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

      Thank you ! I still get an error, but the database is created !

  • @SunnyKumar-ll9nn
    @SunnyKumar-ll9nn 2 роки тому

    Man , was just searching for this .

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

    Finally! Came across Uber Chad bro on this topic, I've been sipping on soy boys for too long trying to wrap my head around this and you nailed it; thx Flask brah.

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

    Thank you so much for your video, you've saved my nick my dear

  • @НекитПлохотнюк
    @НекитПлохотнюк 2 роки тому +2

    Thank u so much. It really helps me.

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

    Very good explanation. Thanks keep it up brother.

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

    Man, you're a genius!

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

    Great video! Came looking here to solve this issue and this video is perfect, can I buy you a coffee?

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

    Awesome video! i have been waiting for this.

  • @ambujsingh-k8b
    @ambujsingh-k8b 21 день тому

    very nice video, really helped me

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

    Still saving lives a year later

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

    Exactly what I needed. Thank you!

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

    Awesome video as always!! Just as a comment, the audio is a bit low but nothing that putting headphones wont solve. Thanks for the great content!

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

    Great tutorial! Nice and easy ton understand explanation!
    Please make more about flask application structure and celery.
    Why do usually people use flask context to use with celery? what are the advantages?

  • @Richard-of9hd
    @Richard-of9hd 10 місяців тому

    Great video thanks for the input!

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

    Great. Could you Just increase The font size?
    another question..where would you put your business logic classes? some tutorials save it to "entities" others leave it with the database models.

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

    Awesome sir, I got my solution.... Thanks a lot

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

    Solid tutorials man!

  • @kpm25
    @kpm25 8 місяців тому

    Subscribed! Which flask app hosting service would you recommend I use?

  • @tompis1442
    @tompis1442 3 роки тому +3

    Amazing video! Can you please make a tutorial on making models that have 3 tables user, planes, hangers and all connected to each other. Lets say a user has a plane that is stored in a hanger he also has and the hanger has the data of the plane that this specific user has? Very complicated. Thanks

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

      Check out my one-to-many relationships and one-to-one relationships videos.

  • @abdurrazzak1612
    @abdurrazzak1612 4 місяці тому

    Very good tutorial

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

    Awesome! There is something that I can return an entrie list to the client side?

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

    Dude you are a G!

  • @drac8854
    @drac8854 3 роки тому +3

    you could make folders like models , routes and forms
    but what i usually do is create blueprint for every part of my app
    example if i am making a e-commerce website (Which i am procrastinating at)
    i would create blueprint for
    1 user
    1.1 orders
    2 product

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

      Yup that works as well. It's similar to the default Django approach.

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

    you are awesome, i have to finish my project until tomorrow and this helped me a lot

  • @open-source243
    @open-source243 2 роки тому

    how much I thank you, You are the best :)

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

    great video, this is fire

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

    Execellent video, thanks🤙🏾🤙🏾

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

    Thanks for this video.

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

    How can we extend flask-SQLAlchemy to use some more customised alembic backed services, example snowflake?

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

    Your tutorials are amazing and I love it. Just one issue with this tutorial is that I get a Error: Failed to find Flask application or factory in module 'myproject'. Use 'myproject:name' to specify one.

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

      I am using python3.11 on an ubuntu jammy os.

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

    THANK YOU !!!!

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

    Thank you for this

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

    Are you gonna make videos to database modeling with sqlalchemy and relationship between tables?

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

      I don't have any plans to make any videos like that for my UA-cam channel, but I am working on a course right now that will cover something along those lines.

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

      @@prettyprinted I am enrolled in your class to flask for beginner in the website, its so cool

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

      You can do that by adding an import to the models under the models/__init__.py

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

    hi, can you make a video for encrypting the form data of login page when it getting posted, before it reaches the endpoint. so when it get posted password cannot be seen in the INSPECT window "Networks" in flask without using JavaScript.
    Appreciate for the great video contents made by you.

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

    Can I use SQLMODEL?

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

    Can u suggest best framework for Flask for creating Restful apis just like Django have DRF?

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

      You're probably not going to find a framework in Flask that is on the level of DRF due to differences in the approaches and communities of the frameworks. Check out Flask-RESTX though: github.com/python-restx/flask-restx

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

    Thanks!!!!

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

    Thanks

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

    Concise!

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

    i have error of models could not be resolved 'how to solve this error' even when m trying to install model error occured

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

    Can someone help. What if I have to use app.config['SOMETHING] inside routes ?

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

    i dont understand how you made flask run work

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

    Hello sir, Is is possible to see all the data from "row = Users.query.all()" , by just using " return row ". I don't want to print the data in html using loop, just want to see all data as soon as possible, like php. And thanks ...(I'm from India, always watch your videos)

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

      I'm sure this is possible in several ways, but I can't think of one that is as simple as PHP. The problem is when you are using SQLAlchemy, you get SQLAlchemy objects in return, so you have to loop over them to see the results. In PHP, you are getting the results directly from the database, so you can show them immediately.

  • @carlos-qs2zs
    @carlos-qs2zs 3 роки тому

    muchas gracias!!!

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

    thanku!!

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

    I feel like title "How to create flask factory app with extensions" would be more descriptive title, nonetheless thank you!

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

    hey man, i've been watching your videos lately, and honestly they've been great so far. I am working on a project and im not quite familiar with the flask environment and folder structure, hence i just wanted to ask you why don't you have an app.py and whats the reason behind using the under init as the root file or the starter of the application, like are there any benefits to that approach. I hope im making sense in what im saying
    edit: another question i have, so when i followed along, it seems that flask migrate wasn't able to find my models, until i imported them in the init file under the migrate.init app line. And now i have the issue of circular imports as i have an association table and its causing an error.

  • @boris---
    @boris--- Рік тому

    amazing to watch whole video than discover nothings work on windows

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

    Flask is so frustrating 😩
    Django life was better :)

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

    This is such a bad example of structuring a Flask application.

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

    Another great tutorial, thanks. Do you have a video on using parameters vs variables in routes? I'm curious as to which is best for which situation. For example I can have /myurl/ and pass in a name like /myurl/marty or I can use params so pass in /myurl/?name=marty and pick it up with name = request.args.get('name'). Is there a reason to use one over the other?

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

      Check flask-marshmallow

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

      I prefer using the query string (?name=...) because it makes the URLs more discoverable. As your app grows, it helps to be able to take a URL and find out which function is handling that URL. With arguments, in the URL, this becomes harder, especially for other people who will look at your code.

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

    sir please can you save my life and explain everything about flask context i'm struggling for 1 week now i did not understand anything , and why we should use with app.app_context()... in our __init__.py

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

    This has not worked for me. When I enter from ------ import db. I am met with ImportError: No module named flask

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

      you need to pip install flask

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

      @@thegringlemingler276 I had flask installed but I was in the wrong conda environment at the time.. woops.

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

    I’m so lazy, I keep stopping to program for a week then retry again for a few days then quit again. 😭😭😭

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

      That's exactly how I started years ago. Those few days that you code start to add up over time, and eventually you might be more motivated to spend more time programming.

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

      @@prettyprinted thanks Pretty Printer

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

    Thank you very much! You helped me.