Placeholder Image

Subtitles section Play video

  • Hello and welcome to Mangane.

  • Be quick star with python manga.

  • TB is one of the most popular and exciting database technologies around Python is one of the most popular and fastest growing language there is.

  • And these two technologies work great together, and that's exactly what this course is about.

  • So we're going to quickly get started monger TB, write some code against it and build some realistic applications.

  • So the goal with this classes to teach him longer to be, we assume, you know a little bit of Python.

  • But you'll, of course, pick some things up along the way if you don't know it already.

  • And really, we want to get you going quick.

  • Hence the name Quick start.

  • So let's get started by talking about what we're going to cover in this course, we're gonna focus on three main things we're going to start with.

  • Why do you care about no sequel and document database?

  • Is how document databases make working with schema as easier modeling data easier as well as ad performance and flexibility to our applications.

  • We're going to talk about modeling, specifically causes one of the things that is pretty challenging about document database is if you come from a relational database world, you probably know about third normal form.

  • This is a way to carefully and structured way to plan out how you model your data in document database is you don't really have that.

  • There's a lot Maur sort of flexibility in how you design things.

  • This is great for you once you understand it and you're really good at it.

  • But it's challenging to know how to model things when you get started, because there's so much flexibility and it's kind of open ended feels a little more like art.

  • It's in science and in some sense, so we're gonna focus specifically on techniques and trade offs and some guidelines I've come up with to help you be successful modeling your data with document databases such as Mama D.

  • B.

  • And then we're gonna start writing code for really we're going to use a mongo odium object document mapper Think of like sequel alchemy.

  • But for document database is called Mongo engine, and we're gonna use that to create some classes to model or data and map those classes to and from Mongo, D B.

  • And use that as the foundation of our application.

  • Speaking of applications, what are we gonna build in this class?

  • Well, we're gonna build an Airbnb clone, but for snakes.

  • Okay, so we're gonna build snake BMB.

  • And this allows you when you're traveling with your snake, your pet snake, you don't want it tohave toe live out in the car or something like that.

  • You want to get us a cage, that it can live in a proper snake.

  • Kato will be happy, so they'll be owners of cages who can put their cages up for rent.

  • And snake owners, pet owners who want to travel with their pets and have their pet have a place to stay.

  • So we're gonna create this sort of silly Airbnb knockoff clone.

  • But we're gonna model many of the operations you would see in real Airbnb on our application here.

  • So it's gonna be pretty rich in terms of data as far as tools go.

  • Well, of course, we're gonna talk about Mongo D B, right?

  • That's the database we're using.

  • But you're also gonna learn some other things that are pretty awesome.

  • In the course, we're gonna talk about mongo engine.

  • This is the primary library we're gonna use to talk to Mongo D B.

  • It's built upon another one.

  • That's a very popular that is sort of the lowest level official way to talk to manga TV called Pi Mongo, so you might see a little bit of both of those.

  • Actually, in the course, we're going to use what I think is the best tool for accessing monger D B.

  • Something used to be called Robo Mongo, but now it's called Robo three T because I was acquired by a company called three D.

  • So this is part command line, part gooey way to interact with Mama D.

  • B.

  • And it's beautiful and free.

  • Open source.

  • It's great.

  • Also, we're gonna use pi charm for python code.

  • You don't have to use private part time for this course, but you'll see me using it, and I think you'll see a lot of benefits as we go speaking to me.

  • Who am I, anyway?

  • Who is this voice that you're listening?

  • Thio.

  • Hi, my name's Michael Kennedy.

  • You find me on Twitter at at Him, Kennedy, and what makes me qualified to teach this course?

  • Well, first of all, I host the most popular python podcast called Talk Python to me, and I've interviewed many, many people, including some of the folks from Mongo tbe the company as well as authors who've written about manga TV design patterns and things like that.

  • So I've had a lot of experience working with people in Python Ahmadi Be I've created the Talk Python training company and written many python courses and manga TV courses there as well.

  • And also, I'm part of the Mahdi Be Masters program.

  • So this is a group of about 35 external community members who give advice back to Mongo.

  • TB and I've been part of this for many years.

  • Work closely with the folks inside monger D B over the years.

  • So this is what you have in store for you.

  • Lots of awesome mommy to be in Python.

  • I hope you're excited.

  • Let's get right to it.

  • Let's begin by looking at why you might choose monger D B over other no sequel databases, other document databases or even other relational databases.

  • I'm sure you've heard of Mongo to be.

  • That's why you're taking this course.

  • But how popular is it relative to other databases?

  • Is it really the right choice.

  • Well, let's look at some data from 2017 if you compare monger to be against other no sequel databases.

  • Cassandra Couch to be raving d be things like that you will find one of these databases is unlike the others.

  • Look at that.

  • That's Red Herbal.

  • How much more popular manga TV is over these?

  • And it's not just the popularity that it's 5 10 times, maybe 50 times more popular than Raven Devi.

  • That's great, is very important, but also the trend right.

  • These others are either flatter, trending downwards.

  • And this is, besides little blip here based on probably like the end of the year numbers or something like that at the end of the data.

  • This is a really big deal, right?

  • This is incredible how much growth that is here, and it's still going up.

  • So manga TV is really, really popular in terms of a database that people are using, and that's great because that means it's well tested when we get to sectional bit later, we'll look at some of the users of manga D B.

  • But it's really important that there are some heavy workloads put onto these databases that you're gonna depend upon.

  • And if it can take what those people are doing, surely it can take what you have to throw it as well.

  • Now, among Devi is also loved.

  • If you look at Stack overflow at their 2017 developer survey, and you look at the most loved databases thes our databases that the developers are using currently and how they feel about it.

  • You see Mama TV ranks right near the top.

  • So definitely 55% of people who are using money to be Lovett compared to, say, like sequel Light or Cassandra.

  • So this pretty good boards even more interesting is that it's the most wanted database.

  • So these air technologies that you're not currently able to work with but you would like to.

  • So there are tons of people that want to work with monger D B.

  • But for whatever reason, they've got some legacy system built on my sequel or whatever.

  • They don't get the chance to.

  • So all these pieces of data tell you manga TV is a really good technology toe have in your tool belt, and it's easy to get a hold of write manga.

  • TB is open source and it's free.

  • You can just go to get up dot com slash manga TB slash mongo and clone it, and it's right there so you can see it has 11,000 stars, 3000 for X and the screen shot I took here.

  • It was updated two hours ago.

  • It's under very, very active development, so it's alive and vibrant.

  • Project Finally, If you actually want to get manga d b don't go to get up, Get up.

  • It's cool.

  • It's great they have the source, but don't go there.

  • What you really want to do is you want to go to manga tv dot com slash download dash center or just go to mommy, G b dot com and click download.

  • It'll take you here and you downloaded here.

  • You get it as binary.

  • So if you're on Mac, I recommend you home brew to install it.

  • But you can also download ah tar ball on windows, get the M s.

  • I.

  • And on Lennox, you can actually install it with aptitude or some package manager like that.

  • And of course, we're not gonna go to the details of setting up manga TV.

  • Just follow the instructions in the full Monty.

  • Be course you have.

  • We walk through all the steps, but we just want to get started.

  • This is the quick start, so let's keep moving.

  • Let's look at one of these records stored in manga TV to see how document database is work.

  • Here we have a Jason record.

  • This is actually from one of my courses.

  • The Python jump start by building 10 APS and this is how I represented in the database.

  • We've got standard column er type things, so we have an I.

  • D.

  • We have a title.

  • Of course I d.

  • On duration seconds.

  • These types of things Now, first of all, you might be wondering.

  • Wait a minute, Jason Database Jason databases that really efficient will probably not.

  • What Monger D B actually stores is a binary representation like a binary, token ized version of this record.

  • But they call it be Sahn because it's like binary Jason.

  • But we're humans.

  • We don't read by an area we re text.

  • So we're looking at the textural representation, so there's not exactly I'll get stored, but it's pretty close.

  • So we have these regular column type pieces of information I d entitle and so on.

  • We also have this other thing, these lectures.

  • Now these lectures air in this chapter represented by this record from this course and notice the bracket and JavaScript, which basically this is means that is a array.

  • And the array contains a bunch of sub objects.

  • So this is really interesting.

  • Instead of just having a chapter table and a lecture table on doing a joint or something like that, a foreign key relationship, we're actually putting the lectures inside the same record.

  • So this is pretty interesting.

  • When you look at it like this, you can imagine that this is like a pre computer join.

  • If I do a query for the lecture, say, given I d 1000 and one on, I get this record back, it already has the lectures.

  • I don't have to make another round trip to the database to get them.

  • I don't have to do a join against several tables in that original query.

  • It's literally a primary key query against an index primary key and is insanely fast.

  • And yet it already comes back with all this extra information.

  • So this is really cool.

  • If I get the chapter, I have the lecture is great, but you might be wondering, Well, really, what if I need to ask the question in reverse?

  • Like, fundamentally, if I need to get at lecture 10,106.

  • Will I be able to query manga TV quickly and efficiently to get that lecture?

  • And it turns out the answer is yes.

  • And that's why document databases are awesome.

  • It's not just like some nested blob stored in the original record you can as part of the query, language, and part of index is perverse, these hierarchies and very, very rich and powerful ways so we don't lose very much query capability just by putting the lectures in this one record.

  • So this is really neat, and this is sort of the foundational, most important takeaway from document databases.

  • We store them in these flexible Jason type of objects and weaken nest additional things like lists of numbers or even sub documents, as we have in this case.

  • Before we move on, let's take a moment and look at who uses monger D B now programming languages and databases and technologies aren't necessarily popularity contests.

  • Justcause simply is popular.

  • It doesn't necessarily mean that it's great, you know, evidence PHP, for example, or V B or something like this.

  • Technologies are popular, and some of them are great.

  • And sometimes great technologies are popular.

  • So there are some important things that come along with being popular and used in big, important companies.

  • And that means these things are durable and tested, and they've really been through the ringer.