I'm really contrasting SQL to other commonly used data manipulation APIs and dataframe libraries like dplyr, pandas, polars etc., but again, appreciate this should be clearer in the blog
I'm really contrasting SQL to other commonly used data manipulation APIs and dataframe libraries like dplyr, pandas, polars etc., but again, appreciate this should be clearer in the blog
The PySpark API has methods for SQL-like operations, so it's familiar to people like you and me who know and love SQL. There is no point to Pandas on a datalake since PySpark has dataframes.
I'm a huge proponent of SQL. I'm dubious of ORMs and think a lot of websites would be more performant if people just learned SQL, or whatever the idiomatic querying language for their chosen DB is. But with datalakes, pyspark is great.
I'm much less worried about that happening to SQL scripts.
If your db is scalable enough (like Snowflake) and you have the money, you can use SQL directly in the same way. But, I've seen data analysts writing bad SQL against Snowflake costing thousands of dollars per query.
It’s really tough to future proof anything. At least with pyspark you will have the code. And, there will always be experts out there. Worse case, if it’s important enough, someone will wrap it in an API and use it until something better comes along (see: 50 year old mainframes still in use).
Is this hosted databricks ?
But, tell me more. I always like a better way.
Is it more efficient to read/write from SSD? Right now, I need everything in memory.
You can choose when to cache the data in memory.
And it's the fact that you can write the code in Python, Scala etc instead of SQL.
So merely writing in a language that we believe will be around forever does not prevent your code from being rewritten.
Also unfamiliarity will make SQL feel inefficient for non-SQL programmers. The experience of rewriting SQL teaches some this lesson. But others find that the familiarity of the language of the rewrite makes it seem better to them, even though it is objectively worse. An objectively worse that only becomes visible when someone needs to optimize it for performance reasons. And it is seldom the programmer who did the inefficient write who has the skills to optimize it back to what SQL did in the first place!
(Yeah, I've had to do those optimization fixes.)
So on seeing one they can sometimes think it's quicker to redo this in a language I know rather than upskill enough to understand this.
One of the biggest problems with spark imo is that people think that the magic cloud is going to make it go fast, when it actually means that the REPL is just muuuuch slower to iterate on.
There are couple of famous examples
https://shopify.engineering/build-production-grade-workflow-...
"By using SQL, a much wider range of people can read your code, including BI developers, business analysts, data engineers and data scientists."
If you really want to advocate for PySpark in this context, you've gotta contend with everything the article brings up:
- More people will be able to understand your code
- Future proofed, with automatic speed improvements and ‘autoscaling’
- Make data typing someone else’s problem
- Simpler maintenance, with less dependency management
- Compatibility with good practice software engineering
- SQL is more expressive and versatile than it used to be
[1] https://mariadb.com/kb/en/quote/
You can then specify columns as a query, group_concat the result and evaluate resulting statement [2].
https://mariadb.com/kb/en/execute-immediate/
I hope that helps.