SQLModel is the Pydantic inspired Python ORM we’ve been waiting for

Sdílet
Vložit
  • čas přidán 23. 03. 2022
  • The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/johnwatsonrooney03221
    An ORM provides a convient layer for us to be able to use Python Objects to talk to our database. It saves us from having to write our own SQL. If you've built any web apps you'll surely have used one, but in this video I want to talk about a relatively new ORM, created by the the same person who made FastAPI. It's build on top of SQLAlchemy and uses Pydantic to make writing code just that little bit easier! I think you will really enjoy using SQLModel.
    sqlmodel.tiangolo.com/
    Demo Code: github.com/jhnwr/shopify-prod...
  • Věda a technologie

Komentáře • 40

  • @JohnWatsonRooney
    @JohnWatsonRooney  Před 2 lety +6

    The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/johnwatsonrooney03221

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

    Thank you for releasing videos often.

  • @katzy687
    @katzy687 Před rokem +5

    You can also add a unique constraint at the db level to safeguard against duplicates, but I would probably also opt for the lookup approach for a smaller one-off type project.

  • @the1gofer
    @the1gofer Před 2 lety +6

    I’ve been learning sqlalchamy for a little while now, and it’s a monster of a library.

  • @mikegraziano5142
    @mikegraziano5142 Před 11 měsíci +1

    Hi John, Thanks for the great tutorials as I try to absorb as much knowledge on Python ORMs. I came from a Java background where I used MyBatis as my ORM and loved it. On that note, I have a question. I want to issue raw SQL and have the ORM's capability populate a collection of objects. That may not be pythonic, but I'd like to know how to do it with declarative mapping. Is it possible and, if so, I'd love to see an example.

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

    Pretty awesome that you got a sponsor John 🔥

  • @RS-tx4bu
    @RS-tx4bu Před 2 lety +4

    Another Excellent and thorough video John! Love and follow your work religiously. Can you kindly make a video on your experience, opinion and pros/cons of Pycharm vs VSCode?

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

      Thanks, very kind. I almost exclusively use PyCharm now, I prefer the auto complete and how it does a lot for you like manage virtual environments. Although I do appreciate that vs code is very similar and both work well. Use whichever you feel comfortable with

    • @RS-tx4bu
      @RS-tx4bu Před 2 lety

      @@JohnWatsonRooney Sounds good John. Thanks.

  • @FunkyELF
    @FunkyELF Před rokem

    How are the models known to the engine/system at the point create_db_and_tables() is called?
    Does anything ever import db.models?

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

    Can this be deployed as an AWS Lambda function?

  • @lencazero4712
    @lencazero4712 Před rokem +1

    Cool video. What type of IDE and Theme you used? Is it VSCode or Sublime.? Thank you.

    • @JohnWatsonRooney
      @JohnWatsonRooney  Před rokem +1

      Hey thanks, this is PyCharm and i think it’s the default theme. It’s been updated since and looks a bit different but still a great ide for python and better than VS Code imo

  • @udaym4204
    @udaym4204 Před 10 měsíci

    how to use on delete cascade or should i first search from all table and then use session.delete() Thank You for makaing can you make video for any database design with sqlmodel video.

  • @htcsaj7876
    @htcsaj7876 Před 2 lety +4

    Amazing channel John. Is it possible to scrape data from some job site and then make a simple website with that data that will automatically update every hour and day. And do you have some longer courses on udemy because these tutorials are awesome.

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

      Yes that is very possible, and relatively easy with something like flask. I have a course that I’ve started working on but as it’s my first it weight take a while

  • @stephanrungweber9622
    @stephanrungweber9622 Před 9 měsíci +2

    Thanks for the video. I would debate your approach of creating tuples to insert to the database.
    a. It’s prone to error when mapping to the database model
    b. If you need to make changes, you won’t get any help by the IDE
    c. It’s hard to debug
    Why not just create a list of instances of the db model in the first place?

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

      Yeah you’re absolutely right, I was very much stuck in tuples -> db which is why I did it this way but of course there’s a better solution!

    • @Rabixter
      @Rabixter Před 4 měsíci

      That's how I like doing it these days too. It's more readable and you can explicitly specify the arguments so you know exactly where each value is being assigned.

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

    Is there a codegen?

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

    have u explored pypika any chance?

    • @JohnWatsonRooney
      @JohnWatsonRooney  Před 2 lety

      No I haven't seen that before, looks interesting I will have a look into it thanks!

  • @Jump-2-the-moon
    @Jump-2-the-moon Před 2 lety +3

    Can you do a video on evading bot detectors (like Akamai)? Also using tools like undetected-chromedriver for evasion?

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

    How can i find the code?

  • @bakasenpaidesu
    @bakasenpaidesu Před rokem +2

    can you make complete tutorial?

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

    I will stick with my dear Django ORM for python.

    • @firdousbhat3339
      @firdousbhat3339 Před 2 lety

      you will miss the taste of Asyncio :)

    • @Troglodyte2021
      @Troglodyte2021 Před 2 lety

      @@firdousbhat3339 I will use raw sql command if Django ORM can't handle my queer cases.

    • @firdousbhat3339
      @firdousbhat3339 Před 2 lety

      @@Troglodyte2021 so u don't like async methods?

  • @mirkolantieri1341
    @mirkolantieri1341 Před 2 lety

    Quite good video tutorial regarding SQL, however shopify lacks the integration of an up-to-date python library to ease up the API/REST development for the backend (they only offer nodejs and php which is nahh) !

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

    Have you ever thought of launching full fledged paid course on popular training sites? I would be happy to subscribe. Plz do share twitter handle to connect wide open-source community.

    • @JohnWatsonRooney
      @JohnWatsonRooney  Před 2 lety

      I have started working on a course now, being the first one I’ve done it might take a while but I will keep you all updated!

  • @Lucifer-wd7gh
    @Lucifer-wd7gh Před 2 lety +2

    Man Your accent is so adorable. Are you British ?

  • @user-ut7pc2di4c
    @user-ut7pc2di4c Před rokem

    I wanted to like the video. But skillshare? Nah... I like something else on the channel.