Creating One-To-Many Relationships in Flask-SQLAlchemy

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 49

  • @jerrygeorge180
    @jerrygeorge180 2 года назад +7

    best explanation so far concerning flask sqlalchemy relationships on RUclips.

  • @marceiaegler5224
    @marceiaegler5224 2 года назад +9

    Thank you SO much for this! I thought my relationships were incorrect, but I was just calling them wrong in my template. I didn't understand backref. You made it very clear!

  • @kaankako
    @kaankako 26 дней назад

    saved my 2 hours thank you

  • @Antonio-yy2ec
    @Antonio-yy2ec 2 года назад +3

    As always, your videos explain everything as clear as water, thank you for sharing them!!

  • @tylersnard
    @tylersnard Год назад

    FINALLY someone explains backref!

  • @sayhellotoroy
    @sayhellotoroy 2 года назад

    That was helpful. Much easier to understand with those artificial fields

  • @Fantasia1013
    @Fantasia1013 2 года назад +1

    bro you are going to heaven !! thank you

  • @RAGEEcs
    @RAGEEcs 2 года назад +1

    underrated

  • @mehranography2117
    @mehranography2117 2 года назад

    This is the best explanation I ever seen thanks

  • @ongayijohnian8787
    @ongayijohnian8787 4 месяца назад

    Could have been explained any better. Thanks a lot, best of luck G 💯

  • @barrientoscardenaslinofern4717
    @barrientoscardenaslinofern4717 2 года назад +1

    Thanks for the video. That's really help me

  • @jamillawrence5370
    @jamillawrence5370 2 года назад +1

    Awesome content Anthony. This really cleared up querying relationships for me.

  • @surajpatil8670
    @surajpatil8670 6 месяцев назад

    Great tutorial! Thank you

  • @etutionlk
    @etutionlk Год назад

    Thanks anthony

  • @oliveroshea5765
    @oliveroshea5765 Год назад

    Great video. The dog's name kept throwing me!!

  • @LostMellodies
    @LostMellodies Год назад

    Thank you so much man, you really helped me, I definitely gonna check out your course. Thanks again.

  • @pedroaragao6999
    @pedroaragao6999 Год назад

    Extremely helpful, thank you!

  • @Faisal-jo5vk
    @Faisal-jo5vk 2 года назад +2

    from where do you see the database after doing create_all()??

  • @robinbreed2439
    @robinbreed2439 Год назад

    This is great, thank you.

  • @chrisgousset8673
    @chrisgousset8673 Год назад

    Awesome video thank you!

  • @RampageousRJ
    @RampageousRJ Год назад

    I am not able to see the foreign key in place using the GUI, am I doing something wrong?

  • @viniciusmelo984
    @viniciusmelo984 2 года назад

    Excellent content!!

  • @edupailemilla
    @edupailemilla Год назад

    hello thanks for the video! I have a question, in the sqlalchemy documentation it shows that its possible to insert Owner and Pet in the same commit. Can I do that with Flask-SQLalchemy? I've been trying, but it throws me an error, because the owner doesn't have an id when the insert operation starts.

  • @hg_ofthecity_old_thi
    @hg_ofthecity_old_thi 2 года назад +1

    Thank you❤

  • @kmishy
    @kmishy 2 года назад

    I'm able to insert a pet with some random owner_id that doesn't exist in user.id! means foreign key is not working! Why?

  • @sachinbisht4368
    @sachinbisht4368 2 года назад

    Suppose I want to create a relationship with say an item(having some quantity) and User.
    and store the owner of the item of the User as well as the quantity of the item.
    Any idea How can you do it?
    Is there any to store like tuples in a column of db?

  • @gabyph2013
    @gabyph2013 2 года назад

    thank you very much, I could understand what does it mean backref, but i saw you didnt out the lazy argument in the parent class, why that? is it optional ?

  • @noahmoore1546
    @noahmoore1546 2 года назад

    Question, what happens if you post it to an owner which doesn't exist?

  • @gregalelov7993
    @gregalelov7993 2 года назад +1

    Great content :), really helped me.
    Can you make some videos on sqlalchemy with FastAPI?

  • @muskulanikhil3623
    @muskulanikhil3623 Год назад

    fantastic

  • @SA-oj3bo
    @SA-oj3bo 2 года назад

    Please keep your clear and calm way of explaining as you did in so many previous videos. This video is rushing just as most of the other content providers do on you tube. your previous tempo was perfect, why start to copy their bad habits? :-)

  • @shreyanshayanger1804
    @shreyanshayanger1804 2 года назад

    Hey I have a question. What if the child component is in a separate model file..then how we will write and connect parent and child classes.
    Example :-- in groups_model.py i have a db model having id ,and name,
    and in another file access.py I have id and is_admin ..
    now i want to connect and map the user according to is_admin's content... how can i connect so ?
    Please help. Thanks

    • @l_sin3398
      @l_sin3398 2 года назад

      add from model import * in access.py
      and add from access import Access in groups_model.py should probably work.

  • @dmbrv
    @dmbrv 2 года назад +1

    nice video.

  • @rezkyparma8795
    @rezkyparma8795 Год назад

    i have problem to search a text in serialized json in my table (let say i just want search by keyword then the keyword is contained in serialized json) , anybody have any thoughts bout this?

    • @prettyprinted
      @prettyprinted  Год назад

      It might best to write raw SQL queries for this. If you're using Postgres, the queries themselves can contain things to search JSON. If you're using a database like SQlite, you'll have to parse the results somehow in Python.

    • @rezkyparma8795
      @rezkyparma8795 Год назад

      @@prettyprinted thanks for the responses, looks like Postgres has better solutions in terms of code simplicity and performance, will definitely give it a try, thanks

  • @emmanueladepoju4089
    @emmanueladepoju4089 2 года назад

    Is this Bi-directional?

  • @DxYPINS
    @DxYPINS 2 года назад

    how have you displayed the database ?

    • @l_sin3398
      @l_sin3398 2 года назад

      Looks like a tool such as DBeaver

    • @yura2110
      @yura2110 2 года назад

      use "DB Browser for SQLite"

  • @NeutralGenericUser
    @NeutralGenericUser 2 года назад +1

    using deprecated backref in 2022. I feel bad for the people mislead by this video, which is nothing more than some lazy Googling. At least find up to date code smh.

    • @madmax6943
      @madmax6943 Год назад

      So if it's deprecated what should I use instead?

    • @georgeg2122
      @georgeg2122 Год назад

      @@madmax6943 back_populates = allows for more complex relationships and clearly shows them but requires one more line of code. backref= becomes confusing and limited to very simple schema. Both are bi-directional and it seems like both of these are outdated but "supported" (SQLAlchemy 1.3). SQLAlchemy 2.0 is current and uses mapped_columns() or more complex mapped entries for ORM. Regardless using back_populates allowed me to have a child table within another child table which was my goal. For any more advanced projects learning the 2.0 framework is probably best for anyone else out there struggling.

    • @shuhaoliang144
      @shuhaoliang144 Год назад

      @@madmax6943 back_populates