Left Outer Join in Flask-SQLAlchemy

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 36

  • @prettyprinted
    @prettyprinted  4 ปีที่แล้ว +2

    Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql

  • @ngozimayo1889
    @ngozimayo1889 4 ปีที่แล้ว +2

    Finally, a decent explanation how to do joins with Flask-SQLAlchemy! Thank you so much Anthony, very helpful.

  • @0KiraDark
    @0KiraDark 5 ปีที่แล้ว +2

    man you saved me, I spent a lot of time trying to understand where I'm committing a mistake in my code but when I saw your video I could solve my problem, thank you.

  • @51_amanverma24
    @51_amanverma24 2 ปีที่แล้ว

    Amazing video, it helped me in one of my project. Thank you sir 👍👍

  • @RamiroJativa
    @RamiroJativa 4 ปีที่แล้ว +2

    Excellent Anthony. Thank you. I share a code example where I apply the use of outerjoin in the way you showed it. BTW: My next challenge is to build an outerjoin with three tables.
    # outerjoin with paginate.
    # The id is selected in the
    # query so that the html page
    # can display the record
    # corresponding to the id.
    # The id is important for the
    # edition of the record and
    # also to delete the record.
    # The other columns are displayed
    # on the screen.
    records = db.session.query(
    Record.id,
    Testlab.testdescription,
    Record.time,
    Record.name,
    Record.organization,
    Record.date,
    Record.place,
    Record.city).outerjoin(
    Testlab,Record.test == Testlab.code).paginate(
    per_page = records_per_page,
    page = page_num,
    error_out = False)
    return render_template('web/records.html', records=records)

  • @ayowandeoluwatosin9365
    @ayowandeoluwatosin9365 2 ปีที่แล้ว

    Awesome tutorial. I would like to self join. That is join a table to itself...I would also like to query a database= result one, iterate through the result one using a for loop to query again another table= result 2 , then add result 2 as a value to a key in result one.. how do I go about either... Thank you

  • @pathak_amit
    @pathak_amit 3 ปีที่แล้ว

    Great explanation. Would appreciate if you could explain how to put a where condition in this? For example, picking records which have made a purchase of greater than 15. Thanks!

  • @cest102
    @cest102 6 ปีที่แล้ว

    Exactly what I was looking for. You're the man.

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      I'm glad the video helped. Thanks for watching!

  • @VelascoPale
    @VelascoPale 4 ปีที่แล้ว

    grateful, but how i can serialize to json those result to use in one function in Ajax like response :((

  • @TheShash1001
    @TheShash1001 6 ปีที่แล้ว

    Thanks for your dedication

  • @jasjyotsingh2007
    @jasjyotsingh2007 4 ปีที่แล้ว

    Cant we do this using the same method shown in One -Many relationship using db.relationships and referencing the object direct. No reference in the other table will simply return a null for the Object column

  • @sohaibbenbouzid9802
    @sohaibbenbouzid9802 4 ปีที่แล้ว

    thank you very much this helped me alot.

  • @adnankayace
    @adnankayace 6 ปีที่แล้ว

    Thank you Anthony!

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      You're welcome! Thanks for watching.

  • @ZOOSnippets
    @ZOOSnippets 6 ปีที่แล้ว

    Hey Anthony, a suggestion for a topic for a video, could you maybe tell more about subqueries in SQLAlchemy?

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      I'll see what I can do. Thanks for the idea.

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      I'll think about creating a video for subqueries. Thanks for the idea.

    • @ZOOSnippets
      @ZOOSnippets 6 ปีที่แล้ว

      That would be great. I currently have a problem to limit data in a relationship between to tables. I have one database with a list of sensors, and linked a table with reading values. I want to make a query in SQLAlchemy to limit the last 10 values from every sensor, but there i get stuck. Your video's helped me a lot with overcome other isues already! Keep up the good work!!

  • @rohit-ld6fc
    @rohit-ld6fc 6 ปีที่แล้ว +1

    How to have multiple ON clause using AND/OR eq.... .....ON atc2.type_id = annotation_type.id AND atc2.customer_id = 12

  • @vaneakatok
    @vaneakatok 5 ปีที่แล้ว

    i am looking for an inner join. there is none, is there any?

  • @carlsagan3295
    @carlsagan3295 6 ปีที่แล้ว

    Very useful, thank you!

  • @dirkb806
    @dirkb806 6 ปีที่แล้ว

    Awesome tut! Any way you can make a part 2 to this video and add an UI? Would love to see a whole example where one can set up an app + db + html and render a db output in html via sqlalchemy (A cherry on the cake would be to bring in a library like chart.js also). Thanks in advance!

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      I'll consider that. Thanks for the idea.

  • @СлавегггНосков
    @СлавегггНосков 6 ปีที่แล้ว

    Thx, Anthony, you're doing a great job. In your video about many-to-many relationship the conjunction table was 'db.Table', not 'Model'. So, here is the question how can I join two tables where one is 'Model' and another is 'Table'. Or maybe conjuction table simply can be db.Model too ?
    thx, again :)

    • @prettyprinted
      @prettyprinted  6 ปีที่แล้ว

      Yeah, the conjunction table can be db.Model. db.Table was just used because I wouldn't need to use it like a normal model.

  • @Thesrik23
    @Thesrik23 6 ปีที่แล้ว

    Hey Anthony How to use multivalueField in Django and please provide some resource to learn it
    Thanks in advance

  • @vaneakatok
    @vaneakatok 5 ปีที่แล้ว

    my two models are connected by an association object (many-to-many)
    I want to filter through this ass_obj
    there are M students and N classes
    any 1 student can take up to N classes. and any 1 class can have up to M students
    How do I query the students from a particular class or the classes that any given student is enrolled in?

  • @hossamashraf4885
    @hossamashraf4885 6 ปีที่แล้ว

    Thanks really helpful :D

  • @SourabhDevlal
    @SourabhDevlal 3 ปีที่แล้ว

    Bro tell me how to put COUNT on the child columns

  • @ReillyChase
    @ReillyChase 6 ปีที่แล้ว

    Very helpful, thanks!