It’s time for another episode of Data Engineering Central Podcast, our third one! Topics in this episode … * Should you use DuckDB or Polars? * Small Engineering Changes (PR Reviews) * Daft vs Spark on Databricks with Unity Catalog (Delta Lake) * Primary and Foreign keys in the Lake House Enjoy! This is a public episode. If you'd like to discuss this with other subscribers or get access to bonus episodes, visit dataengineeringcentral.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_00Welcome to the Data Engineering Central podcast. I'm your host Daniel Beach and this is episode number three. Today we're going to talk about a few topics including should you use DuckDB or Polars, small engineering changes, Daft versus Spark for Delta Lake Tables in Unity Catalog, as well as Primary and Foreign Keys in the Lakehouse Architecture. Today we're going to start off by talking about should you use DuckDB or Polars. Now this is an interesting question mostly because these tools have become incredibly popular.
SPEAKER_00You see them all over social media in the data engineering space. Probably a little bit more on the DuckDB side, Polars seems to be coming along there nice and quickly. But I feel like it's one of those things where everybody is talking about them and probably about 1% of the people are actually using them. So I would say a person would probably on the surface think that these two tools do the exact same thing, DuckDB and Polars, and for the same target audience, because they're both just data tools that you can crunch data tools with, right? I don't think that's necessarily the case all the time.
SPEAKER_00I don't always like to take what the flavor of the day marketing is telling me. I think that instead I prefer to use these tools and watch others use those tools, ask questions, and kind of use common sense. I personally don't think these tools are exactly the same. I might have a little bit of overlap between the two, but I think they're generally far enough apart where you don't really need to choose between DuckDB or Polar's. If you're not familiar with DuckDB, it's the new up-and-coming hot tool. It's a fast, in-process, analytical database. So basically, it's very easy to install.
SPEAKER_00It's single process. It just lives as long as your process. And it's super fast, and it's ANSI SQL. So a lot of people are using it to do data processing, data munging, maybe that they would have done in Pandas or had to load, say, some data into Postgres, things like that. well now people can very easily use duckdb on top of parquet files or csv files say you know on their laptop or even in production workloads that are fairly small able to fit on a single node and polar's polish is kind of like the new era of the data
SPEAKER_00frame polar's is an open source library for data manipulation It's known for being one of the fastest data processing solutions on a single machine right now. It features a well-structured typed API that is based on Rust and it's expressive and easy to use. It's going to be very familiar and a breath of fresh air to those pandas users out there. Right off the bat, you can kind of see that divergence, right? DuckDB is all about the SQL. Polar's is all about the data frame, although Polar's does offer SQL contacts.
SPEAKER_00That's not its main thrust. It kind of lauds itself as a super fast data frame library that you can use for Pandas or even PySpark for, again, smaller loads. Whereas DuckDB is just a general purpose SQL tool that can be used for anything that you would write SQL for. Again, I think that shows that these are different tools on the surface and that they kind of go after different target markets. What it comes down to is DuckDB is SQL-centric and built for those people who work with SQL on a daily basis, and that's a preferred method for everything they do.
SPEAKER_00Honestly, Polar is just the new Pandas. It's for data scientist ML and data frame crazy programmers who probably write code on a daily basis, not that much SQL. Yeah, you can write SQL with Polar SQL context, but if you're building a SQL thing, you should probably reach for DuckDB. You're probably going to have a better experience. You'll be happier in the end. If you're more the programmer type who lives in Python, say you work in Databricks or Pandas a lot, you work around data science and ML, you know, Pollers is going to feel more familiar and probably feel better on your fingertips
SPEAKER_00than DuckDB. I actually did a article about this on my sub stack and I put in a poll that I found was very interesting and I asked people, do you prefer DuckDB, Pollers, or I haven't tried them at all. And it was a pretty fair split. 35% of people said, hey, I use DuckDB. 29 said polars so you know duckdb is just a little bit ahead of polars which you can kind of pick that up from being online you probably see a little bit more content being created around duckdb than polars and then 35 of people say they
SPEAKER_00still haven't tried them yet so kind of a third a third a third almost which is pretty much what you could expect for new tools third of the people haven't used either of them you know most people are using duckdb maybe a little bit less on the polars If you go search around on Reddit, you know there's people asking about where people are using DuckDB in the wild. And people are kind of saying, you know, we use them to look at Parquet files, CSV files. We had Pandas DataFrames in the past, but now we use DuckDB. I used to have to load stuff into Postgres,
SPEAKER_00but now I can just use DuckDB on my laptop to do the same thing. It's faster and easier to use. That totally makes sense. Which is interesting because you would think they would kind of gravitate towards Polars if they're using Pandas files. What it comes down to is a lot of people think of it as an ad hoc data processing tool. So yeah, there are some people putting it in production, you know, but probably most people from what you can see, at least anecdotally on Reddit, they're using this on their laptop as their data processing tool of choice as they're munging, mess around and doing stuff with data locally.
SPEAKER_00They're using DuckDB because it's faster and easier to use. It's funny if you go look up polars on Reddit, you actually find kind of a little bit of negativity. People not totally using it a lot. They're not really sure where it fits. They're not totally sold on it because it looks just like pandas. But honestly, I agree with that. It looks just like pandas. The thing is, it's just a lot faster and a lot cleaner. It's just the new pandas. So, of course, it's going to be less exciting than something like DuckDB. Where Polar's is catching on is actually in production.
SPEAKER_00I've used it in production. It can actually process larger than memory data sets on a single machine, and you can actually swap a lot of Spark workloads for Polar. So for that reason, I think Polar's might be getting its foot in the door in the production use cases a little bit more than DuckDB, where DuckDB is mostly ad hoc on the laptop. Anyways, both these tools are here to stay. They're not going anywhere. Both of them have made inroads into data engineering community, and they'll not be leaving anytime soon. If you're a SQL person, pick up DuckDB.
SPEAKER_00If you like programming and data frames, try out Polars. On to the next topic, small engineering changes, aka PR reviews, for a big win. I feel like this is a very obvious topic, but one that doesn't get talked about a ton. PRs are like the elephant in the room. Everybody hates them, they dread them, but nobody wants to talk about them. No one wants to look them in the eye. I mean, honestly, what it comes down to for most people, there are very few things that are more frustrating, part of their job, than the dreaded PR process.
SPEAKER_00I mean, I've been there myself. I've worked in places where I could break into a sweat while I'm making the PR just because I know all the comments that are coming, and I've worked on places where it doesn't really matter. where you can go PR crazy, get stuff done, people are kind. It just depends where you work. I mean, PRs and pull requests, they are a central part of any good software engineering or data engineering life cycle, yet they are the most frequently fraught with problems. I think that's a cultural issue, and I think a structural issue, and I think there are a few ways you can overcome these issues.
SPEAKER_00i would say at the high level what most people get wrong is that they write too much code in their prs you need to keep prs pull requests and code changes engineering changes you need to keep them as small as possible this is better for you the person writing the code and this is better for the people reviewing the code and will make them kinder and in the end it's going to turn out better for you if you keep the engineering changes as small as possible. Small code changes are easier to review. Small code changes are easier to reason about both as a submitter and the reviewer.
SPEAKER_00You're more likely to get quicker and better feedback on a small engineering change than you are a large one. And there are a few chances for differences of opinion on smaller PRs. Basically, you make it short and sweet, and that's going to be your saving grace. A lot of people say, yeah, well, I'm working on a big change, a big project. What do I do? Break it up into smaller logical changes. Open up maybe say three smaller PRs instead of one giant one. And if you have to have a giant one, set up a meeting or code review beforehand.
SPEAKER_00Some other ideas to help with the PR process is don't throw in extra formatting and non-essential changes into your PR. Open those as separate ones. Don't address multiple bug fixes in a single PR. Don't add formatting and linting changes that just muddy the waters. You gotta keep it small and simple. Don't combine things even though it's tempting. This just confuses a person who's supposed to be reviewing the PR because they're looking at a single change and then they've got all this other stuff going on. It probably makes them upset and,
SPEAKER_00you know, you're probably gonna have a problem when they start leaving comments. They're not gonna be happy with you. There are other things you can do, too, to help with this. You can use CICD to enforce linting and formatting requirements. Use CICD, GitHub Actions, things like that to do the linting and formatting. Don't leave that for the PR person putting it together or the reviewer. This allows them to focus on the actual business logic that's changing now. also culturally be kind to a fault when reviewing or responding to pr comments don't think don't take everything personally learn to be more open-minded and less critical use it as a learning experience not a way to hit someone over the head
SPEAKER_00also you should focus your pr review on the big picture not on the incidentals or coding preferences you should focus on what is the core of the change here and what's going on not on hey I don't really like how you did this. I'd do it a different way. Or, you know, I like functional. I don't like OOP, stuff like that. That's just silly. That's not why someone's putting up code for review. And if you want to give comments like that, just give them as suggestions. Don't make this as a, if you don't change this to the way I would do it, I'm not going to approve it type thing.
SPEAKER_00Also, as a person writing the PR or engineering change, make sure you include an in-depth description of the change and why it's needed, including documentation and any screenshots. Don't just open up something with a bunch of code changes and no explanation. Try to get your thoughts on paper and write it out in the description so that when somebody comes to the PR to review it, they can read through that and then they know exactly what was going on, why you did what you did, and they can go ahead and review the PR quickly. The next topic of discussion is Daft versus Spark on Databricks for Delta Lake
SPEAKER_00tables that are sitting in Unity Catalog. I'm not going to talk a lot about this, but I just wanted to let people know because I think it's pretty awesome. Recently, I was testing out a new DataFrame tool called Daft. I messed with it a little bit before, but recently they released some Unity Catalog integration. which that's a big deal because there's a lot of people on Databricks running Databricks workloads and all the data is typically stored in Delta Lake via Unity Catalog. And it kind of makes it hard without the integration to use outside tools besides Spark.
SPEAKER_00And Daft added this integration and man is it impressive. It is fast and easy. After you get it installed, it's super easy to read a table. You do have to make a few changes in your admin account about credential vending and allowing external engines to read Delta Lake. It just takes a couple of clickety clicks by an admin or you and Databricks. But once that is done, Man, it is fast. It turns out Daft is about three times faster than PySpark on a single node cluster reading 22 million records and doing some aggregations.
SPEAKER_00That's impressive. That will save you serious money on a Databricks account where you're doing a lot of Data processing that could be switched over to the DAF that doesn't necessarily need a massive cluster. Of course, there's many cases where you need to use PySpark distributed big cluster. Let's be truthful with each other. There's a lot of workloads that we run on Databricks just because for continuity and we use Spark and we really don't have to do that. Well, now you've got a new option. Adaft makes it super easy and it's super quick. It'll make you save money and it'll make you happy.
SPEAKER_00Last but not least, I want to talk about an interesting topic, primary and foreign keys in the lake house or the lack thereof. Now, this is a super interesting topic, mostly because if you're an old school person like me, say a Kimball acolyte, people like us who spit on the graves of the non-data warehouse toolkit ignoramuses, people that don't follow kindle you know if you're like me you grew up in a classic data house world sql server oracle postgres all that kind of good stuff you know we lived and breathed the primary and foreign keys they were the heart of a data
SPEAKER_00warehouse they still are but you know now that the lake house has kind of replaced the data warehouse and there is no such thing as a primary and foreign key in those systems does that mean we were misled all the time did we drink the kool-aid are we idiots I mean, think about all those years some of us spent just poring over database tables, coming up with the perfect primary key, coming up with those perfect foreign keys. And it was just at the core of all those third normal form data models we were building. And it's still true to some extent.
SPEAKER_00There's a lot of people still working on OLTP systems, online transactional processing systems, where primary and foreign keys are very very important but a lot of people coming up in the data engineering world now they live in the lake house world they're on snowflake databricks etc and in a lot of those systems for example databricks and a delta lake there is no such thing as a primary and foreign key well there sort of is they let you define them but they are not enforced meaning they're just for show
SPEAKER_00they don't actually mean anything So does that mean the primary and foreign keys are dead? I don't really think so. As someone who's built lake houses on platforms like Databricks and Delta Lake, I still calculate primary keys. I still cascade them through the data sets because it's really about logically being able to understand what is a unique record? How does it relate to these other tables and these other data sets where I can join on this key? I still think primary and foreign keys are a critical component of at least a logical
SPEAKER_00Data design when you're looking at modeling data, I don't think they're dead but it's funny because since they're not really supported in these new systems like Databricks and Delta Lake they're not enforced a lot of people don't use them a lot of the people that are growing up not really starting out and the data where else where the new data engineers and all they know is the lake house and the data lake you know it's just less of a thing than it was for us in the past I don't really think about them as much especially if they haven't spent a lot of times in relational database like Postgres they don't really think of terms primary
SPEAKER_00and foreign keys even though they are critical parts it's just an interesting topic I hope to talk about more in the future just how do you do data modeling in the lake house world when things like primary and foreign keys have kind of fallen to the wayside That's all I got for today's episode. Again, I appreciate you listening, appreciate your support. I'll see you all in the next one.
What happens to software engineers when AI can write most of the code? In this episode of the Data Engineering Central Podcast, I sit down with Gregor Ojstersek, former CTO, author of The Multiplier Mindset (O’Reilly),...
What happens when you finally achieve financial independence, walk away from a successful career in Big Tech, and have the freedom to do whatever you want? Is it everything you imagined it would be? In this episode of...
What does it actually take to build AI systems that work in production? In this episode of Data Engineering Central, I sit down with Maria Vechtomova, AI Engineering Lead, co-founder of CAUCHY, Databricks MVP, and...
I sat down with Erfan Hesami, founder of Pipeline to Insights, to talk about where data engineering is headed as AI and agents become part of everyday engineering work. We dig into the changing role of the data...
What happens when you spend decades building a successful career in tech, finally reach Big Tech, and then suddenly get laid off? In this episode of the Data Engineering Central Podcast, I sit down with AsianDadEnergy...