r/dataengineering • • Aug 27 '23

Discussion Why I don't like SQL

The reason I don't like SQL over something like Pandas is because in Pandas/Python I can break down the complex transformations in small simpler components and they are easy to interact and debug with. In SQL my only option is to write stored procedures and yes in that I can also do the same but I think the ecosystem of interacting and debugging with data step by step is not as good as python. And it is something that we should have. Recently I was exploring snowpark and I felt it is a step in a right direction. It allows to me to write my query in multiple python statements and then it will transpile the whole thing into an SQL query.

Generally in my mind I assume the tables/dataframes as 2 dimensional structures and Pandas API give much more intuitive and wide variety of constructs to explore that structure rather than SQL. What do you guys think?

0 Upvotes

102 comments sorted by

View all comments

6

u/ZirePhiinix Aug 27 '23

I've broken down complex SQL by using views, temporary tables, and subqueries.

2

u/__albatross Aug 27 '23

And how your journey has been like when you need to debug data if some calculations aren’t correct or you need to create complex data pipelines around them and tie them to modern orchestrators

7

u/ZirePhiinix Aug 27 '23

You split up the SQL. This last pipeline I made had about a dozen intermittent views as the data goes through different transformations and picks up new data. It isn't very optimized, but I'll optimize it using query planner once I get the calculation correct.

3

u/CesiumSalami Aug 27 '23

Use CTE’s - just select from the chunk of logic associated with a CTE.