Regarding deserializing nested JSON into your own set of nested classes, I'm using the dacite library and it's been working well. I've forked it (and may have time to contribute that back at some point) so that I can use different field names and paths within the JSON in the object graph than were present in the original JSON. This is really useful for providing a nice internal class hierarchy and object graph from a messy JSON format you get from a 3rd party.
Just ported a solution from Flask with Marshmallows to Fastapi with sqlalchamy and Pydantic, very nice love Orm models, but still could do something with the sql output. I still need to do some json/dict tricks but that is perhaps what he is working on.(sqlmodel), need to look into that.
Perhaps. I'm not sure of Sebastian's plans. But with Pydantic you can do a lot to control the ingest/output for JSON with the .dict(). So it might make sense to dive into Pydantic looking for answers more than SQLModel directly.
We did interview them awhile ago here: talkpython.fm/328 In terms of differences, there are both a sync which is great. Piccolo has a better query syntax but this has pedantic integration which is nice and very useful in FastAPI.
I have a question regarding sqlmodel and pydantic. I created a class based on sqlmodel, and now I want to use that for data validation using pydantic @validator (decorotor) and perform an ORM operation. So how do I do it?
I haven't tried with SQLModel, but in SQLAlchemy you can put `__tablename__ = "the table name"` in the class by the fields and it changes the name. Does it work here?
Hey. Interesting ideas. What Microsoft is doing with blazer and web assembly should be immediately copied in python. ;) for note, we do have projects like Anvil and Idom.
May I know what is the alternate of django's get_or_create in SQLModel in FastAPI? to handle error "unique violation" that occurs when we write in many-to-many with extra fields in a link table..
Not 100% sure, but I'd focus on how to do this in SQLAlchemy as that's the underlying system. The unit of work/session should make it atomic and transcational. So just catch a sqlalchemy.exc.IntegrityError exception, that'd be the signal.
About this: th-cam.com/video/BTCtKWpNoRI/w-d-xo.htmlm40s I think that it should happen the other way around: python guys, ruby guys, etc., should go to all browser makers. And they should show off a *really* cool solution because I don't see why the browser makers would have the motivation to go to somebody. This is a little similar to Kotlin and Google story. Where guys from the Kotlin team went to Google, showed how cool the language is, how well it integrates with Java, etc., so Google decided to make Kotlin the #1 recommended programming language for android. If somebody from the python community could develop a really great solution, then the addition of python runtime to browsers could happen.
I think there is some middle ground: the frameworks/language folks should be responsible for getting their runtimes built and shipped in web assembly in the Dane cadence as their main runtimes. But the browser makers should pick them up and run with it. We get nearly weekly updates for browsers as is and with everything auto update, it would be easy for these to just appear. Last thing needed is a common way to access the languages out of script. :)
It certainly has the very highest growth rate, and makes up about 15% of the web market (whereas another 80% is evenly split between Flask and Django). It is very likely to be the future for APIs for a some time. It can be for web apps, but that is an open question I think. Flask + Django are still good choices too.
Our transcript software breaks down the time by each speaker: Sebastian [guest] (59%) Michael ['dude'] (41%) Having the guest speak 60% of the time seems like a good amount. Would you prefer a monolog?
I really enjoyed watching this, I'm glad Ramirez is getting recognition for building such a nice framework
I agree. People do love his work.
Michael's videos are so clear and helpful!! Seriously so underrated
The legendary framework builder Ramirez 😃😃😃😃
Indeed, it was great to have him on the podcast.
I am very glad that I stumbled upon your video
Regarding deserializing nested JSON into your own set of nested classes, I'm using the dacite library and it's been working well. I've forked it (and may have time to contribute that back at some point) so that I can use different field names and paths within the JSON in the object graph than were present in the original JSON. This is really useful for providing a nice internal class hierarchy and object graph from a messy JSON format you get from a 3rd party.
😊
Thanks for the podcast, good interview!
Thank you for your excellent talk show. Merry Christmas and Happy New Year!
ITS WORKING! nice job dude
Nice tutorial.... Very helpful
Just ported a solution from Flask with Marshmallows to Fastapi with sqlalchamy and Pydantic, very nice love Orm models, but still could do something with the sql output. I still need to do some json/dict tricks but that is perhaps what he is working on.(sqlmodel), need to look into that.
Perhaps. I'm not sure of Sebastian's plans. But with Pydantic you can do a lot to control the ingest/output for JSON with the .dict(). So it might make sense to dive into Pydantic looking for answers more than SQLModel directly.
Is there a tutorial showing the use of FastAPI and SQLModel with a remote DB? Everything is demonstrated local with SQLite.
thank you straight to the point
Thank you for this! Super cool video! A+++
Thanks so much
Since its a young framework can it be integrated with htmx out of the box.
how does this compares to or differenciate from piccolo ORM, new to both and trying to learn the best one
We did interview them awhile ago here: talkpython.fm/328
In terms of differences, there are both a sync which is great. Piccolo has a better query syntax but this has pedantic integration which is nice and very useful in FastAPI.
@@talkpython I see, Thanks :)
I have a question regarding sqlmodel and pydantic. I created a class based on sqlmodel, and now I want to use that for data validation using pydantic @validator (decorotor) and perform an ORM operation. So how do I do it?
When is Sebastian going to do this for Dataframes e.g. pandas?
When migration documents will get updated?
So using sqlmodel we don't need sqlalchemy?
FastAPI is nice , I quite like it
supports Async?
thank you bro thank you
how to override the table name?
I haven't tried with SQLModel, but in SQLAlchemy you can put `__tablename__ = "the table name"` in the class by the fields and it changes the name. Does it work here?
@@mikeckennedy I have come across this scenario before, and yes __tablename__ will work on this scenario
Cool, thanks for letting everyone know.
Wonder if we ever will have a Frontend Framework by Python, I mean sth as popular as React or Vue.
Hey. Interesting ideas. What Microsoft is doing with blazer and web assembly should be immediately copied in python. ;) for note, we do have projects like Anvil and Idom.
th-cam.com/video/kxsLRRY2xZA/w-d-xo.html
all is good
When would the API references be added to FastAPI, it's such a must-have thing...
Hi. Are you referring to some docs showing how to use SQLModel & FastAPI together?
Its in the sqlmodel docs
May I know what is the alternate of django's get_or_create in SQLModel in FastAPI? to handle error "unique violation" that occurs when we write in many-to-many with extra fields in a link table..
Not 100% sure, but I'd focus on how to do this in SQLAlchemy as that's the underlying system. The unit of work/session should make it atomic and transcational. So just catch a sqlalchemy.exc.IntegrityError exception, that'd be the signal.
@@talkpython Thank you Michael. In my case, I had to catch PendingRollbackError, IntegrityError.
hello so how to use mysql with fastapi without ORM?
It's the same as any other mysql code from Python. For example: www.mysqltutorial.org/python-mysql/
About this: th-cam.com/video/BTCtKWpNoRI/w-d-xo.htmlm40s
I think that it should happen the other way around: python guys, ruby guys, etc., should go to all browser makers. And they should show off a *really* cool solution because I don't see why the browser makers would have the motivation to go to somebody.
This is a little similar to Kotlin and Google story. Where guys from the Kotlin team went to Google, showed how cool the language is, how well it integrates with Java, etc., so Google decided to make Kotlin the #1 recommended programming language for android.
If somebody from the python community could develop a really great solution, then the addition of python runtime to browsers could happen.
I think there is some middle ground: the frameworks/language folks should be responsible for getting their runtimes built and shipped in web assembly in the Dane cadence as their main runtimes.
But the browser makers should pick them up and run with it. We get nearly weekly updates for browsers as is and with everything auto update, it would be easy for these to just appear. Last thing needed is a common way to access the languages out of script. :)
i really hope it was based on ponyORM ( the fastest ORM for me ) instead of SQLAlchemy
The newer ORMs are nice aren't they? Beanie is my fav and powers talkpython.fm. ;)
How are views created?
Do you think FastAPI is the future?
It certainly has the very highest growth rate, and makes up about 15% of the web market (whereas another 80% is evenly split between Flask and Django). It is very likely to be the future for APIs for a some time. It can be for web apps, but that is an open question I think. Flask + Django are still good choices too.
but it still does not support sqlalchemy 2.0
my mom told me the computer is the devil
😃
Dude should let his guest speak! sheesh
Our transcript software breaks down the time by each speaker:
Sebastian [guest] (59%)
Michael ['dude'] (41%)
Having the guest speak 60% of the time seems like a good amount. Would you prefer a monolog?
@sebastian gif us this talk in spanish please #latincomunnity