Show HN: SQLFrame – I ran PySpark without Spark on a SQL database (github.com)
I built this because of two common problems I have faced in my career: 1. I prefer to write complex pipelines in PySpark but they can be hard to read for SQL-proficient co-workers. Therefore I find myself in a tradeoff between maintainability and accessibility. 2. I really enjoy using the PySpark DataFrame API but not every project requires Spark and therefore I'm not able to use the DataFrame library I am most proficient in.
The library currently focuses on transformation pipelines (reading from and writing to tables) and data analysis as key use cases. It does offer some ability to read from files directly but they must be small although this can be improved over time if there is demand for it.
SQLFrame currently supports BigQuery, DuckDB, and Postgres with Clickhouse, Redshift, Snowflake, Spark, and Trino in development or planned. You can use the "Standalone" session to test running against any engine supported by SQLGlot but there could be issues with more advanced functions that will be resolved once officially supported by SQLFrame.
Blog post for more details: https://github.com/eakmanrq/sqlframe/blob/main/blogs/sqlfram...
Would love to answer any questions or hear any feedback you may have!
4 comments
[ 1.5 ms ] story [ 22.3 ms ] threadIt seems the main benefit of using something like that in daily life is that it's more convenient to generate complex SQL statements (like pivoting a table with a lot of columns).
However, I never really liked the PySpark dataframe api and looking at the code examples, SQL has the same visual complexity.
Snowflake has built something similar (just for Snowflake) SnowPark [1]. Here one promoted benefit was that you could also inject native Python function and "extend" the SQL dialect. However, I don't think it really took off.
[1] https://github.com/snowflakedb/snowpark-python
In terms of not liking PySpark, I get that the API is not for everyone and if someone doesn't like PySpark then they are unlikely to like SQLFrame. I think it is great we have a variety of options available to us and ideally each team/organization can find an API that works best for their skillsets/needs but also reduces vendor lock. SQLFrame is a great fit for those teams/organizations who want to standadize on PySpark.
In both cases Ibis would not have been a solution for my issue. I think if you haven't learned either then it would come down to if you are more interested in the learning the PySpark DataFrame API or Ibis DataFrame API.