Latest / Talk Python To Me / #454: Data Pipelines with Dagster
Transcript
- 0:00Do you have data that you pull from external sources or that is generated and appears at
- 0:05your digital doorstep?
- 0:06I bet that data needs processed, filtered, transformed, distributed, and much more.
- 0:10One of the biggest tools to create these data pipelines with Python is Dagster.
- 0:15And we're fortunate to have Pedram Navid on the show to tell us about it.
- 0:19Pedram is the head of data engineering and DevRel at Dagster Labs.
- 0:23And we're talking data pipelines this week here at Talk Python.
- 0:28This is Talk Python To Me, episode 454, recorded January 11th, 2024.
- 0:33Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:51This is your host, Michael Kennedy.
- 0:53Follow me on Mastodon, where I'm @mkennedy and follow the podcast using at
- 0:57Talk Python, both on fosstodon.org.
- 1:00Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 1:05We've started streaming most of our episodes live on YouTube.
- 1:09Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified
- 1:14about upcoming shows and be part of that episode.
- 1:18This episode is sponsored by Posit Connect from the makers of Shiny.
- 1:22Publish, share, and deploy all of your data projects that you're creating using Python.
- 1:27Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quattro, Reports, Dashboards, and APIs.
- 1:33Posit Connect supports all of them.
- 1:35Try Posit Connect for free by going to talkpython.fm/posit.
- 1:40Posit Connect.
- 1:41And it's also brought to you by us over at Talk Python Training.
- 1:46Did you know that we have over 250 hours of Python courses?
- 1:50Yeah, that's right.
- 1:51Check them out at talkpython.fm/courses.
- 1:56Last week, I told you about our new course, Build an AI Audio App with Python.
- 2:00Well, I have another brand new and amazing course to tell you about.
- 2:05This time, it's all about Python's typing system and how to take the most advantage of it.
- 2:10It's a really awesome course called Rock Solid Python with Python Typing.
- 2:15This is one of my favorite courses that I've created in the last couple of years.
- 2:19Python type hints are really starting to transform Python,
- 2:23especially from the ecosystem's perspective.
- 2:25Think FastAPI, Pydantic, BearType, etc.
- 2:28This course shows you the ins and outs of Python typing syntax, of course,
- 2:34but it also gives you guidance on when and how to use type hints.
- 2:37Check out this four and a half hour in-depth course at talkpython.fm/courses.
- 2:43Now, on to those data pipelines.
- 2:46Pedram, welcome to Talk Python To Me.
- 2:50It's amazing to have you here.
- 2:51Michael, great to have you.
- 2:52Good to be here.
- 2:53Yeah.
- 2:54Good to talk about data, data pipelines, automation.
- 2:57And boy, oh boy, let me tell you, have I been in the DevOps side of things this week.
- 3:02And I'm going to have a special, special appreciation of it.
- 3:07I can tell already.
- 3:08So excited to talk.
- 3:10My good old, sis.
- 3:11Indeed.
- 3:13So before we get to that, though, before we talk about Dagster and data pipelines and orchestration more broadly,
- 3:19let's just give a little bit of background on you.
- 3:22Introduce yourself for people.
- 3:23How did you get into Python and data orchestration and all those things?
- 3:27Of course.
- 3:27Yeah.
- 3:27So my name is Pedram Navid.
- 3:29I'm the head of data engineering and DevRel at Dagster.
- 3:33That's a mouthful.
- 3:34And I've been a longtime Python user since 2.7.
- 3:38And I got started with Python like I do with many things just out of sheer laziness.
- 3:42I was working at a bank and there was this rote task, something involving going into servers,
- 3:48opening up a text file and seeing if a patch was applied to a server.
- 3:52A nightmare scenario when there's 100 servers to check and 15 different patches to confirm.
- 3:57Yeah.
- 3:57So this kind of predates like the cloud and all that automation and stuff, right?
- 4:01So this is definitely before cloud.
- 4:03This was like right between Python 2 and Python 3.
- 4:06And we were trying to figure out how to use print statements correctly.
- 4:09That's when I learned Python.
- 4:10I was like, there's got to be a better way.
- 4:12And honestly, I've not looked back.
- 4:13I think if you look at my entire career trajectory, you'll see it's just
- 4:17punctuated by finding ways to be more lazy in many ways.
- 4:21Yeah.
- 4:23Who was it?
- 4:24I think it was Matthew Rocklin that had the phrase something like productive laziness or
- 4:29something like that.
- 4:30I'm going to find a way to leverage my laziness to force me to build automation.
- 4:36So I never, ever have to do this sort of thing again.
- 4:39I got that sort of principle.
- 4:40It's very motivating to not have to do something and I'll do anything to not do something.
- 4:44Yeah.
- 4:44Yeah.
- 4:45Yeah.
- 4:45It's incredible.
- 4:46And like that DevOps stuff I was talking about and just, you know, one command and there's
- 4:51maybe eight or nine new apps with all their tiers redeployed, updated, resynced.
- 4:55And it's, it took me a lot of work to get there, but now I never have to think about it again,
- 5:01at least not for a few years.
- 5:02And it's amazing.
- 5:03I can just be productive.
- 5:04It's like right in line, in line with that.
- 5:07So what are some of the Python projects you've been, you've worked on, talked about different
- 5:11ways to apply this over the years?
- 5:13Oh yeah.
- 5:13So it started with internal, just like Python projects, trying to automate, like I said, some
- 5:18rote tasks that I had and that accidentally becomes, you know, a bigger project.
- 5:23People see it and they're like, oh, I want that too.
- 5:25And so, well, now I have to build like a GUI interface because most people don't speak
- 5:29Python.
- 5:29And so that got me into iGUI, I think it was called way back when.
- 5:34That was a fun journey.
- 5:36And then from there, it's really taken off.
- 5:38A lot of it has been mostly personal projects.
- 5:40Trying to understand open source was a really big learning path for me as well.
- 5:45Really being absorbed by things like SQLAlchemy and requests back when they were coming out.
- 5:50Eventually it led to more of a data engineering type of role where I got involved with
- 5:55tools like Airflow and trying to automate data pipelines instead of patches on a server.
- 6:00That one day led to, I guess, making a long story short, a role at Dexter, where now I
- 6:06contribute a little bit to Dexter.
- 6:07I work on Dexter, the core project itself, but I also use Dexter internally to build our
- 6:12own data pipelines.
- 6:13I'm sure it's interesting to see how you all both build Dexter and then consume Dexter.
- 6:19Yeah, it's been wonderful.
- 6:21I think there's a lot of great things about it.
- 6:23One is getting access to Dexter before it's fully released, right?
- 6:27So internally, we dog food, new features, new concepts, and we work with the product team,
- 6:33the engineering team to say, hey, this makes sense.
- 6:35This doesn't.
- 6:35This works really well.
- 6:36That doesn't.
- 6:37And that feedback loop is so fast and so iterative that for me personally, being able to see that
- 6:43come to fruition is really, really compelling.
- 6:45But at the same time, it's like I get to work at a place that's building a tool for me, right?
- 6:49You don't often get that luxury.
- 6:51I've worked in ads.
- 6:53I've worked in insurance.
- 6:54It's like banking.
- 6:55It's like, these are nice things, but it's not built for me, right?
- 6:59And so for me, that's probably been the biggest benefit, I would say.
- 7:01Right.
- 7:02If you work in some marketing thing, you're like, you know, I retargeted myself so well
- 7:06today.
- 7:06You wouldn't believe it.
- 7:07I really enjoyed it.
- 7:09I've seen the ads that I've created before.
- 7:11So it's a little fun, but it's not the same.
- 7:14Yeah.
- 7:15I've heard of people who are really, really good at ad targeting and finding groups where
- 7:21they've like pranked their wife or something or just had an ad that would only show up for
- 7:26their wife by running.
- 7:27It was like so specific and, you know, freaked them out a little bit.
- 7:29That's pretty clever.
- 7:30Yeah.
- 7:32Maybe it wasn't appreciated, but it is clever.
- 7:34Who knows?
- 7:36All right.
- 7:37Well, before we jump in, you said that, of course, you built GUIs with PyGUI and those
- 7:43sorts of things because people don't speak Python back then, two, seven days and whatever.
- 7:47Is that different now?
- 7:48Not that people speak Python, but is it different in the sense that like, hey, I could give them
- 7:53a Jupyter notebook or I could give them Streamlit or one of these things, right?
- 7:58Like a little more or less you build and just like plug it in?
- 8:00I think so.
- 8:01I mean, yeah, like you said, it's not different in that, you know, most people probably still
- 8:05to this day don't speak Python.
- 8:07Yeah.
- 8:07I know we had this like movement a little bit back where everyone was going to learn
- 8:10like SQL and everyone was going to learn to code.
- 8:12I was never that bullish on that trend because like if I'm a marketing person, I've got 10,000
- 8:18things to do and learning to code isn't going to be a priority ever.
- 8:22So I think building interfaces for people that are easy to use and speaks well to them is always
- 8:27useful.
- 8:28That never has gone away.
- 8:29But I think the tooling around it has been better, right?
- 8:32I don't think I'll ever want to use PyGUI again.
- 8:34Nothing wrong with the platform.
- 8:35It's just like not fun to write.
- 8:36Streamlit makes it so easy to do that.
- 8:39So it's like something like Retool and there's like a thousand other ways now that you can
- 8:43bring these tools in front of your stakeholders and your users that just wasn't possible before.
- 8:47I think it's a pretty exciting time.
- 8:48There are a lot of pretty polished tools.
- 8:51Yeah.
- 8:51It's gotten so good.
- 8:52Yeah.
- 8:53There are some interesting ones like OpenBB.
- 8:55Do you know that?
- 8:55The financial dashboard thing.
- 8:58I've heard of this.
- 8:58I haven't seen it.
- 8:59Yeah.
- 8:59It's basically for traders, but it's like a terminal type thing that has a bunch of map
- 9:05plot lib and other interactive stuff that pops up compared to, say, Bloomberg dashboard
- 9:11type things.
- 9:13But yeah, that's one sense where like maybe like traders go and learn Python because it's
- 9:18like, all right, there's enough value here.
- 9:19But in general, I don't think, yeah, I don't think people are going to stop what they're
- 9:23doing and learning the code.
- 9:24So these new UI things are not.
- 9:25All right.
- 9:26Let's dive in and talk about this general category first of data pipelines, data orchestration,
- 9:32all those things.
- 9:33And we'll talk about Dagster and some of the trends and that.
- 9:36So let's grab some random internet search for what does a data pipeline maybe look like?
- 9:41But, you know, people out there listening who don't necessarily live in that space, which
- 9:45I think is honestly many of us, maybe we should, but maybe in our minds, we don't think we live
- 9:50in data pipeline land.
- 9:52Tell them about it.
- 9:53Yeah, for sure.
- 9:54It is hard to think about if you haven't done or built one before.
- 9:57In many ways, a data pipeline is just a series of steps that you apply to some data set that
- 10:02you have in order to transform it to something a little bit more valuable at the very end.
- 10:08That's a simplified version.
- 10:09The devil's in the details.
- 10:10But really, like at the end of the day, you're in a business.
- 10:13The production of data sort of happens by the very nature of operating that business.
- 10:17It tends to be the core thing that, you know, all businesses have in common.
- 10:21And then the other sort of output is you have people within that business who are trying
- 10:25to understand how the business is operating.
- 10:27And this used to be easy when all we had was a single spreadsheet that we could look at once
- 10:31a month.
- 10:31Yeah.
- 10:32I think businesses have gone a little bit more complex than these days.
- 10:35Computers.
- 10:36And the expectations.
- 10:36Like they expect to be able to see almost real time, not I'll see it at the end of the month.
- 10:41Sort of.
- 10:42That's right.
- 10:42Yeah.
- 10:43I think people have gotten used to getting data too, which is both good and bad.
- 10:47Good in the sense that now people are making better decisions.
- 10:49Bad.
- 10:50And then there's more work for us to do.
- 10:51And we can't just sit on our feet for half a day, half a month and waiting for the next
- 10:55request to come in.
- 10:56There's just an endless stream that seems to never end.
- 10:58So that's what really Pipeline is all about.
- 11:00It's like taking these data and making it consumable in a way that users, tools will understand.
- 11:06That helps people make decisions at the very end of the day.
- 11:09That's sort of the nuts and bolts of it.
- 11:10In your mind, does data acquisition live in this land?
- 11:14So for example, maybe we have a scheduled job that goes and does web scraping, calls an
- 11:19API once an hour, and that might kick off a whole pipeline of processing.
- 11:24Or we watch a folder for people to upload over FTP, like a CSV file or something horrible
- 11:32like that.
- 11:32You don't even know what it's unspeakable.
- 11:33But something like that where you say, oh, a new CSV has arrived for me to get, right?
- 11:38Yeah.
- 11:38I think that's the beginning of all data pipeline journeys in my mind.
- 11:42Very much, right?
- 11:43Like an FTP, as much as we hate it, it's not terrible.
- 11:46I mean, there are worse ways to transfer files, but I think it's still very much in use today.
- 11:52And every data pipeline journey at some point has to begin with that consumption of data from
- 11:57somewhere.
- 11:58Yeah.
- 11:58Hopefully it's SFTP, not just straight FTP, like the encrypted.
- 12:02Don't just send your password in the plain text.
- 12:06Oh, well.
- 12:07I've seen that go wrong.
- 12:09That's a story for another day, honestly.
- 12:10All right.
- 12:12Well, let's talk about the project that you work on.
- 12:14We've been talking about it in general, but let's talk about Dagster.
- 12:17Like, where does it fit in this world?
- 12:19Yes.
- 12:20Dagster, to me, is a way to build a data platform.
- 12:24It's also a different way of thinking about how you build data pipelines.
- 12:28Maybe it's good to compare it with kind of what the world was like, I think, before Dagster
- 12:32and how it came about to be.
- 12:34So if you think of Airflow, I think it's probably the most canonical orchestrator out there.
- 12:39But there are other ways which people used to orchestrate these data pipelines.
- 12:43They were often task-based, right?
- 12:45Like, I would download file.
- 12:47I would unzip file.
- 12:48I would upload file.
- 12:50These are sort of the words we use to describe the various steps within a pipeline.
- 12:55Some of those little steps might be Python functions that you write.
- 12:58Maybe there's some pre-built other ones.
- 13:00Yeah.
- 13:00There might be Python.
- 13:01Could be a bash script.
- 13:03Could be logging into a server and downloading a file.
- 13:05Could be hitting requests to download something from the internet and zipping it.
- 13:09Just a various, you know, hodgepodge of commands that would run.
- 13:11That's typically how we thought about it.
- 13:13For more complex scenarios where your data is bigger,
- 13:15maybe it's running against a Hadoop cluster or a Spark cluster.
- 13:18The compute's been offloaded somewhere else.
- 13:20But the sort of conceptual way you tended to think about these things is in terms of tasks, right?
- 13:25Process this thing, do this massive data dump, run a bunch of things,
- 13:29and then your job is complete.
- 13:31With Airflow, or sorry, with Dagster, we kind of flip it around a little bit on our heads.
- 13:36And we say, instead of thinking about tasks,
- 13:38what if we flipped that around and thought about the actual underlying assets that you're creating?
- 13:43What if you told us not, you know, the steps that you're going to take,
- 13:46but the thing that you produce?
- 13:48Because it turns out as people and as data people and stakeholders,
- 13:52really, we don't care about the task.
- 13:54Like, we just assume that you're going to do it.
- 13:56What we care about is, you know, that table, that model, that file, that Jupyter notebook.
- 14:01And if we model our pipeline through that,
- 14:04then we get a whole bunch of other benefits.
- 14:06And that's sort of the Dagster sort of pitch, right?
- 14:08Like, if you want to understand the things that are being produced by these tasks,
- 14:13tell us about the underlying assets.
- 14:15And then when a stakeholder says and comes to you and says, you know,
- 14:17how old is this table?
- 14:19Has it been refreshed lately?
- 14:20Well, you don't have to go look at a specific task.
- 14:22And remember that task ABC had model XYZ.
- 14:25You just go and look up model XYZ directly there, and it's there for you.
- 14:29And because you've defined things in this way,
- 14:31you get other nice things like a lineage graph.
- 14:33You get to understand how fresh your data is.
- 14:36You can do event-based orchestration and all kinds of nice things
- 14:38that are a lot harder to do in a task world.
- 14:40Yeah, more declarative, less imperative, I suppose.
- 14:44Yeah, it's been the trend, I think, in lots of tooling.
- 14:48React, I think, was famous for this as well, right?
- 14:50In many ways.
- 14:51Yeah.
- 14:51It was a hard framework, I think, for people to sort of
- 14:54get their heads around initially,
- 14:55because we were so used to like the jQuery declarative,
- 14:58or jQuery style of doing things.
- 15:01Yeah, how do I hook the event that makes the thing happen?
- 15:03Right?
- 15:03And React said, let's think about it a little bit differently.
- 15:05Let's do this event-based orchestration, really.
- 15:08And I think the proof's in the pudding, React's everywhere now,
- 15:11and jQuery could be not so much.
- 15:12Yeah.
- 15:13There's still a lot of jQuery out there,
- 15:15but there's not a lot of active jQuery.
- 15:18But I imagine there's some.
- 15:19There is, there is, yes.
- 15:20Yeah, just because people are like,
- 15:22you know what, don't touch that, that works.
- 15:23Which is probably the smartest thing people can do, I think.
- 15:26Yeah, honestly.
- 15:27Even though new frameworks are shiny.
- 15:29And, you know, if there's any ecosystem
- 15:32that loves to chase the shiny new idea,
- 15:34it's the JavaScript web world.
- 15:36Oh, yeah.
- 15:36There's no shortage of new frameworks coming out every time.
- 15:39Yeah, I mean, we do too,
- 15:40but not as much as like,
- 15:42that's six months old.
- 15:43That's so old, we can't possibly do that anymore.
- 15:46We're rewriting it.
- 15:46We're going to do the big rewrite again.
- 15:48Mm-hmm.
- 15:48Yep.
- 15:49Fun.
- 15:49Okay, so Dagster is the company,
- 15:52but also is open source.
- 15:53What's the story around, like,
- 15:56can I use it for free?
- 15:57Is it open source?
- 15:57Do I pay for it?
- 15:58100%.
- 15:58Okay.
- 15:59So Dagster Labs is the company.
- 16:00Dagster open source is the product.
- 16:03The 100% free,
- 16:04we're very committed to the open source model.
- 16:06I would say 95% of the things you can get out of Dagster
- 16:09are available through open source.
- 16:11And we tend to try to release everything through that model.
- 16:14You can run very complex pipelines
- 16:16and you can deploy it all on your own if you wish.
- 16:19There is a Dagster Cloud product,
- 16:20which is really the hosted version of Dagster.
- 16:22If you want hosted plain,
- 16:24we can do that for you through Dagster Cloud,
- 16:26but it all runs on the same code base
- 16:28and the modeling and the files
- 16:29all essentially look the same.
- 16:31Mm-hmm.
- 16:31Okay.
- 16:32So obviously you could get,
- 16:34like I talked about at the beginning,
- 16:35you could go down the DevOps side,
- 16:36get your own open source Dagster set up,
- 16:39schedule it, run it on servers,
- 16:41all those things.
- 16:41But if we just wanted something real simple,
- 16:44we could just go to you guys and say,
- 16:46hey, I built this with Dagster.
- 16:47Will you run it for me?
- 16:49Pretty much.
- 16:49Yeah.
- 16:49Right.
- 16:50So there's two options there.
- 16:51You can do the serverless model,
- 16:53which says, you know, Dagster, just run it.
- 16:54We take care of the compute,
- 16:56we take care of the execution for you,
- 16:57and you just write the code
- 16:58and upload it to GitHub
- 17:00or any, you know, repository of your choice
- 17:02and we'll sync to that and then run it.
- 17:04The other option is to do the hybrid model.
- 17:06So you basically do the CI/CD aspect.
- 17:08You just say, you push to name your branch.
- 17:11If you push to that branch,
- 17:13that means we're just going to deploy a new version
- 17:15and whatever happens after that,
- 17:16it'll be in production, right?
- 17:18Exactly.
- 17:18Yeah.
- 17:18And we offer some templates that you can use
- 17:21in GitHub for workflows
- 17:22in order to accommodate that.
- 17:23Excellent.
- 17:24Then I cut you off.
- 17:25You're saying something about hybrid.
- 17:27Hybrid is the other option.
- 17:28For those of you who want to run your own compute,
- 17:30you don't want the data leaving your ecosystem,
- 17:32you can say, we've got this Kubernetes cluster,
- 17:35this ECS cluster,
- 17:36but we still want to use the Dagster Cloud product
- 17:38to sort of manage the control plane.
- 17:40Dagster Cloud will do that.
- 17:41And then you can go off
- 17:42and execute things on your own environment
- 17:44if that's something you wish to do.
- 17:45Oh yeah, that's pretty clever
- 17:46because running stuff in containers isn't too bad,
- 17:49but running container clusters,
- 17:50all of a sudden,
- 17:52you're back doing a lot of work, right?
- 17:54Exactly, yeah.
- 17:55Yeah.
- 17:55Okay, well, let's maybe talk about Dagster for a bit
- 17:58that I want to talk about some of the trends as well,
- 18:01but let's just talk through maybe setting up a pipeline.
- 18:03Like, what does it look like?
- 18:05You know, you talked about in general,
- 18:06less imperative, more declarative,
- 18:08but what does it look like?
- 18:10Be careful about talking about code on audio,
- 18:12but you know, just give us a sense
- 18:14of what the programming model feels like for us.
- 18:16As much as possible,
- 18:17it really feels like just writing Python.
- 18:19It's pretty easy.
- 18:21You add a decorator on top of your existing Python function
- 18:24that does something.
- 18:25That's a simple decorator called asset.
- 18:27And then your pipeline,
- 18:29that function becomes a data asset.
- 18:31That's how it's represented in the Dagster UI.
- 18:33So you could imagine you've got a pipeline
- 18:35that gets like maybe Slack analytics
- 18:38and uploads that to some dashboard, right?
- 18:41Your first pipeline,
- 18:42your function would be called something like Slack data,
- 18:44and that would be your asset.
- 18:45In that function is where you do all the transform,
- 18:48the downloading of the data
- 18:50until you've really created that fundamental data asset
- 18:52that you care about.
- 18:53And that could be stored either,
- 18:55you know,
- 18:55you know,
- 18:55data warehouse to F3,
- 18:57however you sort of want to persist it,
- 18:59that's really up to you.
- 18:59And then the resources is sort of where the power,
- 19:02I think,
- 19:03of a lot of Dagster comes in.
- 19:04So the asset is sort of like declaration
- 19:06of the thing I'm going to create.
- 19:07The resource is how I'm going to,
- 19:10you know,
- 19:10operate on that,
- 19:11right?
- 19:11Because sometimes you might want to have a,
- 19:14let's say,
- 19:15a DuckDB instance locally
- 19:16because it's easier and faster to operate.
- 19:18But when you're moving to the cloud,
- 19:19you want to have a Databricks or a Snowflake.
- 19:22You can swap out resources based on environments
- 19:24and your asset can reference that resource.
- 19:27And as long as it has that same sort of API,
- 19:29you can really flexibly change between
- 19:32where that data is going to be persistent.
- 19:34Does Dagster know how to talk to those different platforms?
- 19:36Does it like natively understand DuckDB and Snowflake?
- 19:40Yeah.
- 19:40So it's interesting.
- 19:41People often look to Dagster and like,
- 19:43oh,
- 19:43does it do X?
- 19:44And the question is like,
- 19:46Dagster does anything you can do Python with.
- 19:48Which is most things.
- 19:49Yeah.
- 19:49Which is most things.
- 19:50So I think if you come from the Airflow world,
- 19:52you're very much used to like these Airflow providers.
- 19:54And if you want to use...
- 19:55That's kind of what I was thinking.
- 19:56Yeah.
- 19:56Yeah.
- 19:57You want to use a Postgres,
- 19:58you need to find the Postgres provider.
- 19:59You want to use S3,
- 20:00you need to find the S3 provider.
- 20:01With Dagster,
- 20:02you kind of say,
- 20:03you don't have to do any of that.
- 20:04If you want to use Snowflake,
- 20:05for example,
- 20:06install the Snowflake connector package from Snowflake,
- 20:09and you use that as a resource directly.
- 20:10And then you just run your SQL that way.
- 20:13There are some places where we do have integrations that help.
- 20:17If you want to get into the weeds with IO manager,
- 20:18it's where we persist the data on your behalf.
- 20:21And so for S3,
- 20:22for Snowflake,
- 20:23for example,
- 20:23there's other ways where we can persist that data for you.
- 20:26But if you're just trying to run a query,
- 20:28just trying to execute something,
- 20:30just trying to save something somewhere,
- 20:31you don't have to use that system at all.
- 20:33You can just use whatever Python package you would use anyway to do that.
- 20:37So maybe some data is expensive for us to get as a company.
- 20:42Like maybe we're charged on a usage basis or super slow or something.
- 20:46I could write just Python code that goes and say,
- 20:48well,
- 20:48look in my local database.
- 20:50If it's already there,
- 20:51use that and it's not too stale.
- 20:52Otherwise,
- 20:53then do actually go get it,
- 20:54put it,
- 20:55put it there,
- 20:56and then get it back.
- 20:57And like that kind of stuff would be up to me to put together.
- 21:00Yeah.
- 21:01And that's the nice thing is you're not really limited by like anyone's data model
- 21:05or world view on how data should be retrieved or saved or augmented.
- 21:09You could do it a couple of ways.
- 21:10You could say,
- 21:11whenever I'm working locally,
- 21:12use this persistent data store that we're just going to use for development purposes.
- 21:17Fancy database called SQLite,
- 21:19something like that.
- 21:20Exactly.
- 21:20Yes.
- 21:20A wonderful database.
- 21:21And actually it's,
- 21:22yeah,
- 21:23it'll work really,
- 21:24really well.
- 21:24And then you just say,
- 21:25when I'm in a different environment,
- 21:26when I'm in production,
- 21:27swap out my SQLite resource for a name,
- 21:30your favorite cloud warehouse resource and go fit,
- 21:33fetch that data from there.
- 21:34Or I want to use it mini IO locally.
- 21:36I want to use S3 on prod.
- 21:38It's very simple to swap these things out.
- 21:40Okay.
- 21:40Yeah.
- 21:41So it looks like you build up these assets as y'all call them,
- 21:44these pieces of data,
- 21:46Python code that accesses them.
- 21:48And then you have a nice UI that lets you go and build those out kind of workflow style,
- 21:54right?
- 21:54Yeah,
- 21:54exactly.
- 21:55This is where we get into the wonderful world of DAGs,
- 21:57which stands for directed acyclic graph.
- 22:00I think it stands for a bunch of things that are not connected in a circle,
- 22:04but are connected in some way.
- 22:05So there can't be any loops,
- 22:06right?
- 22:07Because then you never know where to start or where to end.
- 22:08Could be a diamond,
- 22:09but not a circle,
- 22:11right?
- 22:11Not a circle.
- 22:12As long as there's like a path through this data set with the beginning and an end,
- 22:17then we can kind of start to model this connected graph of things.
- 22:21And then we know how to execute them,
- 22:22right?
- 22:23We can say,
- 22:23well,
- 22:23this is the first thing we have to run because that's where all dependencies start.
- 22:26And then we can either branch off in parallel or we can continue linearly until everything
- 22:31is complete.
- 22:31And if something breaks in the middle,
- 22:33we can resume from that broken spot.
- 22:35Okay.
- 22:35Excellent.
- 22:36And is that the recommended way?
- 22:38Like if I write all this Python code that works on the pieces,
- 22:41then the next recommendation would be to fire up the UI and start building it?
- 22:45Or do you say,
- 22:46ah,
- 22:46you should really write it in code and then you can just visualize it or monitor it?
- 22:50Everything in Dagster is written as code.
- 22:51The UI reads that code and it interprets it as a DAG and then it displays that for you.
- 22:57There are some things to do with the UI.
- 22:58Like you can materialize assets,
- 23:00you can make them run,
- 23:01you can do backfills,
- 23:02you can view metadata,
- 23:03you can sort of enable and disable schedules.
- 23:06But the core,
- 23:07we really believe this is Dagster,
- 23:08like the core declaration of how things are done,
- 23:11it's always done through code.
- 23:13Okay.
- 23:13Excellent.
- 23:13So when you say materialize,
- 23:15maybe I have an asset,
- 23:17which is really a Python function I wrote that goes and pulls down a CSV file.
- 23:22The materialize would be,
- 23:23I want to see kind of representative data in this,
- 23:26in the UI.
- 23:28so I could go,
- 23:29all right,
- 23:29I think this is right.
- 23:30Let's keep passing it down.
- 23:31Is that what that means?
- 23:32Materialize really means just run this particular asset,
- 23:34make this asset new again,
- 23:36fresh again,
- 23:37right?
- 23:37As part of that materialization,
- 23:39we sometimes output metadata.
- 23:41And you can kind of see this on the right.
- 23:42If you're looking at the screen here,
- 23:44where we talk about what the timestamp was,
- 23:46the URL,
- 23:47there's a nice little graph of like number of rows over time.
- 23:51All that metadata is something you can emit.
- 23:53And we emit some ourselves by default with the framework.
- 23:56And then as you materialize these assets,
- 23:58as you run that asset over and over again,
- 24:00over time,
- 24:01we capture all that.
- 24:01And then you can really get a nice overview of,
- 24:04you know,
- 24:04this asset's lifetime,
- 24:05essentially.
- 24:06Nice.
- 24:06Yeah.
- 24:07I think the asset,
- 24:08the metadata is really pretty excellent,
- 24:10right?
- 24:10Over time,
- 24:11you can see how the data's grown and changed.
- 24:14Yeah.
- 24:14The metadata is,
- 24:15is really powerful.
- 24:16And it's one of the nice benefits of being in this asset world,
- 24:19right?
- 24:19Because you don't really want to metadata on like this task that run.
- 24:22You want to know like this table that I created,
- 24:24how many rows has it had every single time it's run?
- 24:27Because if that number drops by like 50%,
- 24:29that's a big problem.
- 24:30Conversely,
- 24:31if the runtime is slowly increasing every single day,
- 24:34you might not notice it,
- 24:35but over a month or two,
- 24:36it went from a 30 second pipeline to 30 minutes.
- 24:39maybe there's like a great place to start optimizing that one specific asset.
- 24:43Right.
- 24:43And what's cool if it's just Python code,
- 24:45you know how to optimize that probably,
- 24:47right?
- 24:47Hopefully.
- 24:48Yeah.
- 24:48Well,
- 24:49as much as you're going to,
- 24:51yeah,
- 24:51you got,
- 24:51you have all the power of Python and you should be able to,
- 24:55as opposed to it's deep down inside some framework that you don't really.
- 24:57Exactly.
- 24:58Yeah.
- 24:58You use Python,
- 24:59you can benchmark it.
- 25:00There's probably,
- 25:01you probably knew you didn't write it that well when you first started and you can
- 25:05always find ways to improve it.
- 25:07So this UI is something that you can just run locally.
- 25:09Kind of like Jupyter.
- 25:10A hundred percent.
- 25:11Just type Degester dev and then you get the full UI experience.
- 25:15You get to see the runs,
- 25:16all your assets.
- 25:17Is it a web app?
- 25:18It is.
- 25:19Yeah.
- 25:19It's a web app.
- 25:20There's a Postgres backend.
- 25:21And then there's a couple of services that run the web server,
- 25:24the GraphQL,
- 25:25and then the workers.
- 25:26Nice.
- 25:26Yeah.
- 25:27So pretty serious web app.
- 25:28It sounds like,
- 25:28but yeah,
- 25:30just something you run all probably containers or something.
- 25:36You just fire up when you download it.
- 25:38Right.
- 25:38Locally it doesn't even use containers.
- 25:39It's just all pure Python for that.
- 25:42But once you deploy,
- 25:43yeah,
- 25:44I think you might want to go down the container route,
- 25:46but it's nice not having to have Docker just to like run a simple test deployment.
- 25:50Yeah.
- 25:50I guess not everyone's machine has that for sure.
- 25:53So question from the audience here.
- 25:55Jazzy asks,
- 25:56does it hook into AWS in particular?
- 25:59Is it compatible with existing pipelines like ingestion lambdas or transform lambdas?
- 26:04Yeah,
- 26:05you can hook into AWS.
- 26:06So we have some AWS integrations built in.
- 26:09Like I mentioned before,
- 26:10there's nothing stopping you from importing Boto3 and doing anything really you want.
- 26:14So a very simple use case,
- 26:15like let's say you already have an existing transformation being triggered in AWS through
- 26:20some Lambda.
- 26:20You could just model that within Dagster and say,
- 26:23you know,
- 26:23trigger that Lambda Boto3.
- 26:25Okay.
- 26:26Then the asset itself is really that representation of that pipeline,
- 26:30but you're not actually running that code within Dagster itself.
- 26:32That's still occurring on the AWS framework.
- 26:34And that's a really simple way to start adding a little bit of observability and orchestration
- 26:38to existing pipelines.
- 26:39Okay.
- 26:40That's pretty cool because now you have this nice UI and these metadata in this history,
- 26:45but it's someone else's cloud.
- 26:47Exactly.
- 26:47Yeah.
- 26:47Yeah.
- 26:48And you can start to pull more information in there.
- 26:50And over time,
- 26:51you might decide,
- 26:51you know,
- 26:52this,
- 26:52you know,
- 26:53Lambda that I had,
- 26:53it's starting to get out of hand.
- 26:54I want to kind of break it apart into multiple assets where I want to sort of optimize it a
- 26:59little way in Dagster can help you along that.
- 27:01Yeah.
- 27:02Excellent.
- 27:02How do you set up,
- 27:04like triggers or observability inside Dagster?
- 27:07Like Jazzy's asking about S3,
- 27:09but like in general,
- 27:10right?
- 27:11If a row is entered into a database,
- 27:13something is dropped in a blob storage or the date changes.
- 27:16I don't know.
- 27:16Yeah.
- 27:17Those are great questions.
- 27:18You have a lot of options.
- 27:19In Dagster,
- 27:19we do model every asset with a couple little flags,
- 27:23I think that are really useful to think about.
- 27:24One is whether the code of that particular asset has changed.
- 27:28Right.
- 27:28And then the other one is whether anything upstream of that asset has changed.
- 27:32And those two things really power a lot of automation functionality that we can get downstream.
- 27:37So let's start with the,
- 27:39I think the S3 example is the easiest to understand.
- 27:41You have a bucket and there is,
- 27:43you know,
- 27:44a file that gets uploaded every day.
- 27:45You don't know what time that file gets uploaded.
- 27:47You don't know when it'll be uploaded,
- 27:49but you know,
- 27:49at some point it will be in Dagster.
- 27:51We have a thing called the sensor,
- 27:52which you can just connect to an S3 location.
- 27:55You can define how it looks into that file or into that folder.
- 27:58And then you would just pull every 30 seconds until something happens.
- 28:02When that something happens,
- 28:04that triggers sort of an event.
- 28:06And that event can trickle at your will downstream to everything that depends on it
- 28:10as you sort of connect to these things.
- 28:11So it gets you awake from this,
- 28:13like,
- 28:13Oh,
- 28:13I'm going to schedule something to run every hour.
- 28:16Maybe the data will be there,
- 28:17but maybe it won't.
- 28:18And you can have a much more event-based workflow.
- 28:20When this file runs,
- 28:21I want everything downstream to know that this data has changed.
- 28:24And as sort of data flows through these systems,
- 28:26everything will sort of work its way down.
- 28:28Yeah,
- 28:29I like it.
- 28:29This portion of Talk Python To Me is brought to you by Posit,
- 28:34the makers of Shiny,
- 28:35formerly RStudio,
- 28:37and especially Shiny for Python.
- 28:39Let me ask you a question.
- 28:41Are you building awesome things?
- 28:43Of course you are.
- 28:44You're a developer or data scientist.
- 28:45That's what we do.
- 28:46And you should check out Posit Connect.
- 28:48Posit Connect is a way for you to publish,
- 28:51share,
- 28:52and deploy all the data products that you're building using Python.
- 28:55People ask me the same question all the time.
- 28:58Michael,
- 28:59I have some cool data science project or notebook that I built.
- 29:02How do I share it with my users,
- 29:03stakeholders,
- 29:04teammates?
- 29:05Do I need to learn FastAPI or Flask or maybe Vue or React.js?
- 29:10Hold on now.
- 29:11Those are cool technologies,
- 29:12and I'm sure you'd benefit from them,
- 29:14but maybe stay focused on the data,
- 29:15project.
- 29:16Let Posit Connect handle that side of things.
- 29:18With Posit Connect,
- 29:19you can rapidly and securely deploy the things you build in Python.
- 29:23Streamlit,
- 29:24Dash,
- 29:24Shiny,
- 29:25Bokeh,
- 29:25FastAPI,
- 29:26Flask,
- 29:27Quarto,
- 29:27ports,
- 29:28dashboards,
- 29:28and APIs.
- 29:29Posit Connect supports all of them.
- 29:32And Posit Connect comes with all the bells and whistles to satisfy IT and other enterprise requirements.
- 29:38Make deployment the easiest step in your workflow with Posit Connect.
- 29:42For a limited time,
- 29:43you can try Posit Connect for free for three months by going to talkpython.fm/posit.
- 29:48That's talkpython.fm/P-O-S-I-T.
- 29:52The link is in your podcast player show notes.
- 29:53Thank you to the team at Posit for supporting Talk Python.
- 29:59The sensor concept is really cool because I'm sure that there's a ton of cloud machines,
- 30:05people provisioned, just because this thing runs every 15 minutes, that runs every 30 minutes,
- 30:10and you add them up and aggregate, we need eight machines just to handle the automation rather than,
- 30:16you know, because they're hoping to catch something without too much latency,
- 30:19but maybe like that actually only changes once a week.
- 30:21Exactly.
- 30:22And I think that's where we have to like sometimes step away from the way we're so used to thinking
- 30:27about things.
- 30:28And I'm guilty of this.
- 30:29When I create a data pipeline, my natural inclination is to create a schedule where it's
- 30:33a, is this a daily one?
- 30:34Is this weekly?
- 30:35Is this monthly?
- 30:36But what I'm finding more and more is when I'm creating my pipelines, I'm not adding a schedule.
- 30:40I'm using Dacister's auto-materialized policies, and I'm just telling it, you figure it out.
- 30:45I don't have to think about schedules.
- 30:46Just figure out when the things should be updated.
- 30:48When it's, you know, parents have been updated, you run.
- 30:51When the data has changed, you run.
- 30:53And then just like figure it out and leave me alone.
- 30:55Yeah.
- 30:55And it's worked pretty well for me so far.
- 30:57I think it's great.
- 30:57I have a search, refresh the search index on the various podcast pages that runs and it
- 31:04runs every hour, but the podcast ships weekly, right?
- 31:08But I don't know which hour it is.
- 31:09And so it seems like that's enough latency, but it would be way better to put just a little
- 31:14bit of smarts.
- 31:15Like what was the last date that anything changed?
- 31:18Was that since the last time you saw it?
- 31:19Maybe we'll just leave that alone.
- 31:21You know, you're starting to inspire me to go write more code, but pretty cool.
- 31:25All right.
- 31:26So on the homepage at Dagster.io, you've got a nice graphic that shows you both how to write
- 31:33the code, like some examples of the code, as well as how that looks in the UI.
- 31:37And one of them is called, says to launch backfills.
- 31:41What is this backfill thing?
- 31:43Oh, this is my favorite thing.
- 31:44Okay.
- 31:44Okay.
- 31:45So when you first start your data journey as a data engineer, you sort of have a pipeline
- 31:50and you build it and it just runs on a schedule and that's fine.
- 31:53What you soon find is, you know, you might have to go back in time.
- 31:58You might say, I've got this data set that updates monthly.
- 32:01Here's a great example.
- 32:02AWS cost reporting, right?
- 32:04AWS will send you some data around, you know, all your instances and your S3 bucket, all
- 32:10that.
- 32:10And it'll update that data every day or every month or whatever have you.
- 32:14Due to some reason, you've got to go back in time and refresh data that AWS updated due
- 32:18to some like discrepancy.
- 32:19Backfill is sort of how you do that.
- 32:21And it works hand in hand with this idea of a partition.
- 32:24A partition is sort of how your data is naturally organized.
- 32:27And it's like a nice way to represent that natural organization.
- 32:31It has nothing to do with like the fundamental way, how often you want to run it.
- 32:34It's more around like, I've got a data set that comes in once a month, it's represented monthly.
- 32:39It might be updated daily, but it's the representation of the data is monthly.
- 32:43So I will partition it by month.
- 32:44It doesn't have to be dates.
- 32:45It could be strings.
- 32:47It could be a list.
- 32:48You could have a partition for every company or every client or every domain you have,
- 32:55whatever you sort of think is a natural way to think about breaking apart that pipeline.
- 32:59And once you do that partition, you can do these nice things called backfills, which says,
- 33:04instead of running this entire pipeline and all my data, I want you to pick that one month
- 33:08where your data went wrong or that one month where data was missing and just run the partition
- 33:12on that range.
- 33:13And so you limit compute, you save resources and get a little bit more efficient.
- 33:18And it's just easier to like think about your pipeline because you've got this natural
- 33:22built-in partitioning system.
- 33:23Excellent.
- 33:24So maybe you missed some important event.
- 33:27Maybe your automation went down for a little bit, came back up.
- 33:31You're like, oh no, we've, we've missed it.
- 33:33Right.
- 33:33But you want to start over for three years.
- 33:36So maybe we could just go and run the last day.
- 33:39It's worth it.
- 33:40Exactly.
- 33:40Or another one would be your vendor says, hey, by the way, we actually screwed up.
- 33:44We uploaded this file from two months ago, but the numbers were all wrong.
- 33:48So we've uploaded a new version to that destination.
- 33:51Can you update your data set?
- 33:52One way is to recompute the entire universe from scratch.
- 33:55But if you've partitioned things and you can say, no, limit that to just this one partition
- 34:00for that month.
- 34:01And that one partition can trickle down all the way to all your other assets that depend
- 34:04on that one.
- 34:05Do you have to pre decide, do you have to think about this partitioning beforehand or can you
- 34:10do it retroactively?
- 34:11You could do it retroactively.
- 34:12And I have done that before as well.
- 34:14It really depends on, on where you're at.
- 34:16I think it's your first asset ever.
- 34:18Probably don't bother with partitions, but it really isn't a lot of work to get them to
- 34:23get them started.
- 34:23Okay.
- 34:24Yeah.
- 34:25Really neat.
- 34:25I like a lot of the ideas here.
- 34:27I like that it's got this visual component that you can see what's going on, inspect it.
- 34:33You also see you can debug runs.
- 34:34What happens there?
- 34:35Like, obviously, when you're pulling data from many different sources, maybe it's not your
- 34:40data you're taking in.
- 34:41Fields can vanish.
- 34:42It can be the wrong type.
- 34:43Systems can go down.
- 34:44I'm sure.
- 34:45Sure.
- 34:46The debugging is interesting.
- 34:47So what's it looks a little bit kind of like a web browser debug dev tools thing.
- 34:52So for the record, my code never fails.
- 34:54I've never had a bug in my life.
- 34:56But for the other you have.
- 34:57Yeah.
- 34:58Well, mine doesn't.
- 34:59I only do it to make an example and remind me how others.
- 35:02Yes.
- 35:03If I do, it's intentional, of course.
- 35:05Yeah.
- 35:05To humble myself a little bit.
- 35:07Exactly.
- 35:07This view is one of my favorite.
- 35:10I mean, so many favorite views.
- 35:11But this is, it's actually really fun to watch.
- 35:13Watch this actually run when you execute this pipeline.
- 35:16But really, like, let's go back to, you know, the world before orchestrators.
- 35:20We use cron, right?
- 35:22We'd have a bash script that would do something.
- 35:24And we'd have a cron job that said, make sure this thing runs.
- 35:27And then hopefully it was successful, but sometimes it wasn't.
- 35:30And it's a sometimes it wasn't.
- 35:32That's always been the problem, right?
- 35:34It's like, well, what do I do now?
- 35:35How do I know why it failed?
- 35:36What was, when did it fail?
- 35:38You know, at what point or what steps did it fail?
- 35:40That's really hard to do.
- 35:42What this debugger really is, is a structured log of every step that's been going on through your pipeline, right?
- 35:48So in this view, there's three assets that we can kind of see here.
- 35:51One is called users.
- 35:53One is called orders.
- 35:54And one is to run dbt.
- 35:56So presumably there's these two, you know, tables that are being updated.
- 35:59And then a dbt job, it looks like that's being updated at the very end.
- 36:02Once you execute this pipeline, all the logs are captured from each of those assets.
- 36:07So you can manually write your own logs.
- 36:10You have access to a Python logger and you can use your info, your error, whatever have you, in log output that way.
- 36:16And it'll be captured in a structured way.
- 36:18But it also capture logs from the integrations.
- 36:21So using dbt, we capture those logs as well.
- 36:24You can see it processing every single asset.
- 36:26So if anything does go wrong, you can filter down and understand at what step, at what point did something go wrong.
- 36:33That's awesome.
- 36:34And just the historical aspect.
- 36:36Because just going through logs, especially multiple systems, can be really, really tricky to figure out what's the problem.
- 36:43What actually caused this to go wrong?
- 36:45But come back and say, oh, it crashed.
- 36:47Pull up the UI and see.
- 36:49All right.
- 36:49Well, show me what this run did.
- 36:52Show me what this job did.
- 36:53And it seems like it's a lot easier to debug than your standard web API or something like that.
- 36:57You can click onto any of these assets that get that metadata that we had earlier as well.
- 37:02If, you know, one step failed and it's kind of flaky, you can just click on that one step and say, just rerun this.
- 37:08Everything else is fine.
- 37:09We don't need to restart from scratch.
- 37:10Okay.
- 37:10And it'll keep the data from before.
- 37:13So you don't have to rerun that.
- 37:15Yeah.
- 37:15I mean, it depends on how you built the pipeline.
- 37:18We like to build idempotent pipelines is how we sort of talk about it, the data engineering landscape, right?
- 37:23So you should be able to run something multiple times and not break anything in a perfect world.
- 37:27That's not always possible.
- 37:28But ideally, yes.
- 37:29And so we can presume that if users completed successfully, then we don't have to run that again because that data was persisted, you know, database S3 somewhere.
- 37:38And if orders was the one that was broken, we can just only run orders and not have to worry about rewriting the whole thing from scratch.
- 37:46So idempotent for people who maybe don't know, you run it once or you perform the operation once or you perform it 20 times, same outcome.
- 37:53Should have side effects, right?
- 37:55That's the idea.
- 37:55Yeah.
- 37:56That's the idea.
- 37:56Easier something done sometimes.
- 37:58It sure is.
- 38:00Sometimes it's easy.
- 38:00Sometimes it's very hard.
- 38:01But the more you can build pipelines that way, the easier your life becomes in many ways.
- 38:07Generally, not always, but generally true for programming as well, right?
- 38:10If you talk to functional programming people, they'll say like, it's an absolute, but.
- 38:14Yes.
- 38:14Functional programmers love this kind of stuff.
- 38:17And it actually does lend itself really well to data pipelines.
- 38:20Data pipelines, unlike maybe some of the software engineering stuff, it's a little bit different in that the data changing is what causes often most of the headaches, right?
- 38:30It's less so the actual code you write, but more the expectations tend to change so frequently and so often in new and novel and interesting ways that you would often never expect.
- 38:40And so the more you can sort of make that function so pure that you can provide any sort of data set and really test really easily.
- 38:48These expectations, when they get the easier it is to sort of debug these things and build on them in the future.
- 38:54Yeah.
- 38:54And cache them as well.
- 38:55Yes.
- 38:56It's always nice.
- 38:57Yeah.
- 38:57So speaking of that kind of stuff, like what's the scalability story?
- 39:02If I've got some big, huge, complicated data pipeline, can I parallelize them and have them run multiple pieces?
- 39:10Like if there's different branches or something like that?
- 39:12Yeah, exactly.
- 39:13That's one of the key benefits, I think, in writing your assets in this DAG way, right?
- 39:19Anything that is parallelizable will be parallelized.
- 39:22Now, sometimes you might want to put limits on that.
- 39:24Sometimes too much parallelization is bad.
- 39:25Your poor little database can't handle it.
- 39:27And you can say, you know, maybe a concurrency limit on this one just for today is worth putting.
- 39:33Or if you're hitting an API for an external vendor, they might not appreciate 10,000 requests a second on that one.
- 39:38So maybe you would slow it down.
- 39:40But in essence...
- 39:41Or rate limiting, right?
- 39:41You can run into too many requests and then your stuff crashes.
- 39:45Then you got to start.
- 39:45It can be a whole thing.
- 39:46It can be a whole thing.
- 39:47There's memory concerns.
- 39:48But let's pretend the world is simple.
- 39:50Anything that can be paralyzed will be through Dexter.
- 39:54And that's really the benefit of writing these DAGs is that there's a nice algorithm for determining what that actually looks like.
- 39:59Yeah.
- 39:59I guess if you have a diamond shape or any sort of split, right?
- 40:03Those two things now become...
- 40:04Because it's acyclical.
- 40:06They can't turn around and then eventually depend on each other again.
- 40:09So...
- 40:09That's a perfect chance to just go fork it out.
- 40:12Exactly.
- 40:12And that's kind of where partitions are also kind of interesting.
- 40:15If you have a partitioned asset, you could take your data set, partition it to five buckets and run all five partitions at once, knowing full well that because you've written this in a idempotent and partition way, that the first pipeline will only operate on apples and the second one only operates on bananas.
- 40:31And there is no commingling of apples and bananas anywhere in the pipeline.
- 40:35Oh, that's interesting.
- 40:36I hadn't really thought about using the partitions for parallelism, but of course...
- 40:39Yeah.
- 40:39It's a fun little way to break things apart.
- 40:43So if we run this on the Dagster cloud or even on our own, this is pretty much automatic.
- 40:49We don't have to do anything.
- 40:51Like Dagster just looks at it and says, this looks parallelizable and it'll go or...
- 40:55That's right.
- 40:55Yeah.
- 40:55As long as you've got the full deployment, whether it's OSS or cloud, Dagster will basically parallelize it for you as much as possible.
- 41:02Excellent.
- 41:02You can set global concurrency limits.
- 41:04So you might say, you know, 64 is more than enough, you know, parallelization that I need.
- 41:09Or maybe I want less because I'm worried about overloading systems.
- 41:12It's really up to you.
- 41:13I'm putting this on a $10 server.
- 41:15Please don't.
- 41:16Please don't kill it.
- 41:18Just respect that it's somewhat wimpy, but that's okay.
- 41:21It'll get the job done.
- 41:22It'll get the job done.
- 41:23All right.
- 41:24I want to talk about some of the tools and some of the tools that are maybe at play here when working with Dagster and some of the trends and stuff.
- 41:31But before that, it may be speak to where you could see people adopt a tool like Dagster, but they generally don't.
- 41:38They don't realize like, oh, actually, there's a whole framework for this, right?
- 41:42Like I could, sure, I could go and build just on HTTP server and hook into the request and start writing to it.
- 41:50But like, maybe I should use Flask or FastAPI.
- 41:52Like there's these frameworks that we really naturally adopt for certain situations like APIs and others, background jobs, data pipelines, where I think there's probably a good chunk of people who could benefit from stuff like this.
- 42:06But they just don't think they need a framework for it.
- 42:08Like Cron is enough.
- 42:10Yeah, it's funny because sometimes Cron is enough.
- 42:12And I don't want to encourage people not to use Cron.
- 42:15But think twice, at least, is what I would say.
- 42:19So probably the first like trigger for me of thinking of, you know, is that actually a good choice is like, am I trying to ingest data from somewhere?
- 42:26That's something that fails.
- 42:28Like, I think we just can accept that, you know, if you're moving data around, the data source will break.
- 42:33The expectations will change.
- 42:34You will need to debug it.
- 42:36You will need to run it.
- 42:37And doing that in Cron is a nightmare.
- 42:38So I would say definitely start to think about an orchestration system if you're ingesting data.
- 42:43If you have a simple Cron job that sends one email, like, you're probably fine.
- 42:47I don't think you need to implement all of DAG searches just to do that.
- 42:50But the more closer you get to data pipelining, I think the better your life will be if you're not trying to debug a obtuse process that no one really understands six months from now.
- 43:04Excellent.
- 43:04All right.
- 43:05Maybe we could touch on some of the tools that are interesting.
- 43:08You see people using, you talked about DuckDB and DBT, a lot of D's starting here.
- 43:13But give us a sense of like some of the supporting tools you see a lot of folks using that are interesting.
- 43:19Yeah, for sure.
- 43:19I think in the data space, probably DBT is one of the most popular choices.
- 43:25And DBT, in many ways, it's nothing more than a command line tool that runs a bunch of SQL in a DAG as well.
- 43:34So there's actually a nice fit with Dijkstra and DBT together.
- 43:37DBT is really used by people who are trying to model that business process using SQL against typically a data warehouse.
- 43:45So if you have your data in, for example, Postgres, Snowflake, Databricks, Microsoft SQL, these types of data warehouses, generally you're trying to model some type of business process.
- 43:57And typically people use SQL to do that.
- 44:00Now you can do this without DBT, but DBT has provided a nice clean interface to doing so.
- 44:06It makes it very easy to connect these models together, to run them, to have a development workflow that works really well.
- 44:12And then you can push it to prod and have things run again in production.
- 44:15So that's DBT.
- 44:16We find it works really well.
- 44:18And a lot of our customers are actually using DBT as well.
- 44:21There's DuckDB, which is a great, it's like the SQLite for columnar databases, right?
- 44:27Yeah.
- 44:27It's in process.
- 44:28It's fast.
- 44:29It's written by the Dutch.
- 44:30There's nothing you can't like about it.
- 44:32It's free.
- 44:32We love that.
- 44:33It feels very comfortable in Python itself.
- 44:36It does.
- 44:37It's so easy.
- 44:37Yes, exactly.
- 44:39The Dutch have given us so much and they've asked nothing of us.
- 44:42So I'm always very thankful for them.
- 44:44It's fast.
- 44:45It's so fast.
- 44:45It's like if you've ever used Pandas for processing large volumes of data, you've occasionally hit memory limits or inefficiencies in doing these large aggregates.
- 44:56I won't go into all the reasons of why that is, but DuckDB sort of changes that because it's a fast serverless sort of C++ written tooling to do really fast vectorized work.
- 45:08And by that, I mean like it works on columns.
- 45:10So typically in like SQLite, you're doing transactions.
- 45:13You're doing single row updates, writes, inserts, and SQLite is great at that.
- 45:18Where typical transactional databases fail or aren't as powerful is when you're doing aggregates, when you're looking at an entire column, right?
- 45:25Just the way they're architected.
- 45:26If you want to know the average, the median, the sum of some large number of columns, and you want to group that by a whole bunch of things, you want to know the first date someone did something and the last one.
- 45:37Those types of vectorized operations, DuckDB is really, really fast at doing.
- 45:42And it's a great alternative to, for example, Pandas, which can often hit memory limits and be a little bit slow in that regard.
- 45:50Yeah, it looks like it has some pretty cool aspects, transactions, of course.
- 45:53But it also says direct Parquet, CSV, and JSON querying.
- 45:59So if you've got a CSV file hanging around and you want to ask questions about it or JSON or some of the data science stuff through Parquet, turn an indexed proper query engine against it.
- 46:10Don't just use a dictionary or something, right?
- 46:12Yeah.
- 46:12It's great for reading a CSV, zip files, tar files, Parquets, partition Parquet files, all that stuff that usually was really annoying to do and operate on.
- 46:22You can now install DuckDB.
- 46:24It's got a great CLI, too.
- 46:25So before you go and program your entire pipeline, you just run DuckDB and you start writing SQL against CSV files and all this stuff to really understand your data and just really see how quick it is.
- 46:37I used it on a bird data set that I had as an example project and there was millions of rows and I was joining them together and doing massive group buys and it was done in like seconds.
- 46:48And it's just hard for me to believe that it was even correct because it was so quick.
- 46:52So it's wonderful.
- 46:53I must have done that wrong somehow because it's done.
- 46:57It shouldn't be done.
- 46:57Yeah.
- 46:58Yeah.
- 46:58And the fact it's in process means there's not a babysit, a server for you to babysit patch, make sure it's still running.
- 47:06It's accessible, but not too accessible.
- 47:08All that, right?
- 47:09It's a pip and sell away, which is always, we love that, right?
- 47:12Yeah, absolutely.
- 47:12You mentioned, or I guess I mentioned Parquet, but also Apache Arrow seems like it's making its way into a lot of different tools and sort of foundational sort of high memory, high performance in memory processing.
- 47:25Have you used this, Eddie?
- 47:26I've used it, especially through like working through different languages.
- 47:29So moving data between Python and R is where I last used this.
- 47:34I didn't know Arrow's great at that.
- 47:35I believe Arrow is like the underneath some of the Rust to Python as well.
- 47:40It's working there.
- 47:41So typically I don't use Arrow like directly myself, but it's in many of the tooling I use.
- 47:47Right.
- 47:47It's a great product.
- 47:48And like so much of the ecosystem is now built on Arrow.
- 47:52Yeah, I think a lot of it is, I feel like the first time I heard about it was through Polars.
- 47:55That's right.
- 47:56Yeah.
- 47:56I'm pretty sure, which is another Rust story for kind of like Pandas, but a little bit more fluent, lazy API.
- 48:04Yes.
- 48:05We live in such great times, to be honest.
- 48:07So Polars is a Python bindings for Rust, I believe is kind of how I think about it.
- 48:13It does all the transformation in Rust, but you've had this Python interface to it and it makes things, again, incredibly fast.
- 48:20I would say similar in speed to DuckDB.
- 48:22They both are quite comparable sometimes.
- 48:24Yeah, it also claims to have vectorized and columnar processing and all that kind of stuff.
- 48:29Yeah, it's pretty incredible.
- 48:30So not a drop-in replacement for Pandas, but if you have the opportunity to use it and you don't need to use the full breadth of what Pandas offers, because Pandas is quite a huge package.
- 48:40There's a lot it does.
- 48:41But if you're just doing simple transforms, I think Polars is a great option to explore.
- 48:45Yeah, I talked to Richie Vink, who is part of that, and I think they explicitly chose to not try to make it a drop-in replacement for Pandas, but tried to choose an API that would allow the engine to be smarter and go like, I see you're asking for this, but the step before you wanted this other thing.
- 49:01So let me do that transformation all in one shot and a little bit like a query optimization engine.
- 49:06Yeah.
- 49:07What else is out there?
- 49:08We've got time for just a couple more.
- 49:09If there's anything that you're like, oh, yeah, people use this all the time.
- 49:12Obviously, the databases, you've said, Postgres, Snowflake, et cetera.
- 49:15Yeah, there's so much.
- 49:17So another little one I like, it's called DLT, DLT Hub.
- 49:20It's getting a lot of attraction as well.
- 49:23And what I like about it is how lightweight it is.
- 49:25I'm such a big fan of lightweight tooling that's not, you know, massive frameworks.
- 49:29Loading data is, I think, still kind of yucky in many ways.
- 49:32It's not fun.
- 49:33And DLT makes it a little bit simpler and easier to do so.
- 49:36So that's what I would recommend people just look into if you got to either ingest data from, you know, some API, some website, some CSV file.
- 49:45It's a great way to do that.
- 49:47It claims it's the Python library for data teams loading data into unexpected places.
- 49:52Very interesting.
- 49:53Yes, that's great.
- 49:54Yeah, this looks cool.
- 49:55All right.
- 49:56Well, I guess maybe let's talk about, let's talk business and then we can talk about what's next and then we'll probably be out of time.
- 50:02I'm always fascinated.
- 50:04I think there's starting to be a bit of a blueprint for this, but companies that take a thing, they make it and they give it away and then they have a company around it.
- 50:11And, you know, congratulations to you all for doing that.
- 50:14Right.
- 50:14And a lot of it seems to kind of center around the open core model, which I don't know if that's exactly how you would characterize yourself.
- 50:23But maybe you talk about the business side, because I know there's many successful open source projects that don't necessarily result in full time jobs or companies if people were to want that.
- 50:32It's a really interesting place.
- 50:33And I don't think it's one that anyone has truly figured out well.
- 50:38I can say this is the way forward for everyone, but it is something we're trying.
- 50:41And I think for Dexter, I think it's working pretty well.
- 50:44And what I think is really powerful about Dexter is like the open source product is really, really good.
- 50:49And it hasn't really been limited in many ways in order to drive like cloud product consumption.
- 50:55Yeah, sure.
- 50:55We really believe that there's actual value in that separation of these things.
- 50:58There are some things that we just can't do in the open source platform.
- 51:01For example, there's pipelines on cloud that involve, you know, ingesting data through our own systems in order to do reporting, which just doesn't make sense to do on the open source system.
- 51:10It makes the product way too complex.
- 51:12But for the most part, I think Dexter open source, like we really believe that like just getting it in the hands of developers is the best way to prove the value of it.
- 51:19And if we can build a business on top of that, I think we're all super happy to do so.
- 51:23It's nice that we get to sort of drive both sides of it.
- 51:27To me, that's like one of the more exciting parts, right?
- 51:29A lot of the development that we do in Dexter open source is driven by people who are paid through, you know, what happens on Dexter cloud.
- 51:36And I think from what I can tell, there's no better way to build open source product than to have people who are adequately paid to develop that product.
- 51:44Otherwise, it can be, you know, a labor of love, but one that doesn't last for very long.
- 51:48Yeah, whenever I think about building software, there's 80% of it that's super exciting and fun, 10%.
- 51:53And then there's that little sliver of like really fine polish that if it's not just your job to make that thing polished, you're just for the most part, just not going to polish that bit, right?
- 52:04It's tough. UI, design, support.
- 52:07There's all these things that go into making software like really extraordinary.
- 52:11That's really, really tough to do.
- 52:13And I think I really like the open source business model.
- 52:16I think for me, being able to just try something, not having to talk to sales and being able to just deploy locally and test it out and see if this works.
- 52:24And if I choose to do so, deploy it in production.
- 52:28Or if I bought the cloud product and I don't like the direction that is going, I can even go into open source as well.
- 52:34That's pretty compelling to me.
- 52:35Yeah, for sure it is.
- 52:36And I think the more moving pieces of infrastructure, the more uptime you want and all those types of things, the more somebody who's maybe a programmer but not a DevOps infrastructure person but needs to have it there, right?
- 52:50Like that's an opportunity as well, right?
- 52:52For you to say, look, you can write the code.
- 52:54We made it cool for you to write the code, but you don't have to like get notified when the server's down or whatever.
- 53:00Like we'll just take care of that for you.
- 53:01That's pretty awesome.
- 53:02Yeah.
- 53:02And there's efficiencies of scale as well, right?
- 53:04Like we've learned the same mistakes over and over again, so you don't have to, which is nice.
- 53:08I don't know how many people who want to maintain servers, but people do.
- 53:12And they're more than welcome to if that's how they choose to do so.
- 53:15Yeah, for sure.
- 53:16All right.
- 53:17Just about out of time.
- 53:18Let's close up our conversation with where are things going for Dagster?
- 53:22Like what's on the roadmap?
- 53:24What are you excited about?
- 53:25Oh, that's a good one.
- 53:26I think we've actually published our roadmap line somewhere.
- 53:29If you search Dagster roadmap, it's probably out there.
- 53:31I think for the most part, that hasn't changed much going into 2024, though we may update it.
- 53:36There it is.
- 53:37We're really just doubling down on what we've built already.
- 53:40I think there's a lot of work we can do on the product itself to make it easier to use, easier to understand.
- 53:45My team specifically is really focused around the education piece.
- 53:49And so we launched Dagster University's first module, which helps you really understand the core.
- 53:54Our next module is coming up in a couple months, and that'll be around using Dagster with DBT, which is our most popular integration.
- 54:01We're building up more integrations as well.
- 54:03So I've built a little integration called Embedded ELT that makes it easy to ingest data.
- 54:09But I want to actually build an integration with DLT as well, DLT Hub.
- 54:12So we'll be doing that.
- 54:13And there's more coming down the pipe, but I don't know how much I can say.
- 54:17Look forward to an event in April where we'll have a launch event on all that's coming.
- 54:23Nice.
- 54:23Is that an online thing people can attend or something?
- 54:26Exactly.
- 54:27Yeah, there'll be some announcement there on the Dagster website on that.
- 54:30Maybe I will call it one thing that's actually really fun.
- 54:32It's called Dagster Open Platform.
- 54:34It's a GitHub repo that we launched a couple months ago, I want to say.
- 54:39We took our internal...
- 54:41I should go back one more.
- 54:42Sorry.
- 54:42It's like GitHub, Dagster Open Platform and GitHub.
- 54:45I have it somewhere.
- 54:47Yeah.
- 54:48It's here under the organization?
- 54:51Yes, it should be somewhere in here.
- 54:54There it is.
- 54:54Dagster Open Platform on GitHub.
- 54:56And it's really a clone of our production pipelines for the most part.
- 55:00There's some things we've chosen to ignore because they're sensitive.
- 55:03But as much as possible, we've defaulted to making it public and open.
- 55:06And the whole reason behind this was because, you know,
- 55:09as data engineers, it's often hard to see how other data engineers write code.
- 55:12We get to see how software engineers write code quite often,
- 55:14but most people don't want to share their platforms for various good reasons.
- 55:19Also, there's like smaller teams or maybe just one person.
- 55:23And then like those pipelines are so integrated into your specific infrastructure, right?
- 55:29So it's not like, well, here's a web framework to share, right?
- 55:32Like, here's how we integrate into that one weird API that we have that no one else has.
- 55:36So it's no point in publishing it to you, right?
- 55:38That's typically how it goes.
- 55:39Or they're so large that they're afraid that there's like some, you know,
- 55:43important information that they just don't want to take the risk on.
- 55:46Yep.
- 55:46And so we built like something that's in the middle where we've taken as much as we can
- 55:49and we've publicized it.
- 55:50And you can't run this on your own.
- 55:52Like, that's not the point.
- 55:53The point is to look at the code and see, you know, how does Dagster use Dagster?
- 55:56And what does that kind of look like?
- 55:57Nice.
- 55:57Okay.
- 55:58All right.
- 55:58Well, I'll put a link to that in the show notes and people can check it out.
- 56:01Appreciate it.
- 56:02Yeah.
- 56:02I guess let's wrap it up with the final call to action.
- 56:05People are interested in Dagster.
- 56:06How do they get started?
- 56:07What do you tell them?
- 56:07Oh, yeah.
- 56:08Dagster.io is probably the greatest place to start.
- 56:11You can try the cloud product.
- 56:13We have free self-serve or you can try the local install as well.
- 56:17If you get stuck, a great place to join is our Slack channel, which is up on our website.
- 56:22There's even a Ask AI channel where you can just talk to a Slack bot that's been trained
- 56:27on all our GitHub issues and discussions.
- 56:29And it's surprisingly good at walking you through, you know, any debugging, any issues or even advice.
- 56:34That's pretty excellent, actually.
- 56:36Yeah.
- 56:36It's real fun.
- 56:37It's really fun.
- 56:37And if that doesn't work, we're also there in the community where you can just chat to
- 56:40us as well.
- 56:41Cool.
- 56:42All right.
- 56:43Well, Pedram, thank you for being on the show.
- 56:45Make sure all the work on Dagster and sharing it with us.
- 56:47Thank you, Michael.
- 56:47You bet.
- 56:48See you later.
- 56:48This has been another episode of Talk Python To Me.
- 56:52Thank you to our sponsors.
- 56:53Be sure to check out what they're offering.
- 56:55It really helps support the show.
- 56:56This episode is sponsored by Posit Connect from the makers of Shiny.
- 57:01Publish, share, and deploy all of your data projects that you're creating using Python.
- 57:06Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.
- 57:12Posit Connect supports all of them.
- 57:15Try Posit Connect for free by going to talkpython.fm/posit, P-O-S-I-T.
- 57:22Want to level up your Python?
- 57:23We have one of the largest catalogs of Python video courses over at Talk Python.
- 57:27Our content ranges from true beginners to deeply advanced topics like memory and async.
- 57:32And best of all, there's not a subscription in sight.
- 57:35Check it out for yourself at training.talkpython.fm.
- 57:38Be sure to subscribe to the show.
- 57:40Open your favorite podcast app and search for Python.
- 57:43We should be right at the top.
- 57:44You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 57:49and the direct RSS feed at /rss on talkpython.fm.
- 57:53We're live streaming most of our recordings these days.
- 57:56If you want to be part of the show and have your comments featured on the air,
- 58:00be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 58:04This is your host, Michael Kennedy.
- 58:06Thanks so much for listening.
- 58:08I really appreciate it.
- 58:09Now get out there and write some Python code.
- 58:11I'll see you next time.