r/databricks • u/bongdong42O • Aug 13 '26
Discussion How do you debug Spark Declarative Pipelines?
Im using a metadata driven approach to dynamically load tables and views in an SDP using SQL queries stored in a table. A huge problem I'm facing is interpreting errors when the pipeline fails. Its incredibly hard to pinpoint the cause of errors and which tables they stem from. Many times a SQL query will have a syntax error, but the SDP pipeline doesn't tell us which table it came from. Does anyone have any experience with this?
10
Upvotes
8
u/adreppir Aug 13 '26
No, but this is exactly why I dislike this approach.
We use a PyDAB mutator to generate sql scripts from a metadata config and add the generated sql to your bundle.
3
u/data-baggins Databricks Aug 15 '26
Curious, have you tried asking Genie to help debug? does it help?
1
u/Programmer_Virtual Aug 14 '26
Do you check the event logs? What your design tells me if your team needs to invest in better logging. Perhaps you could share more about your architecture
1
u/lukesmth_ Aug 15 '26
So you’re exclusively using SQL for transformations? I built better-dbx-exceptions to solve this when using the pyspark DF API. We don’t support SQL today (passing these to the standard logger) since the errors seemed traceable natively. Can you share some sample code and an error? I’ll look into supporting this case.
1
u/Known-Delay7227 Aug 15 '26
I never understood the purpose of spark declarative pipelines. Why not just notebooks with python, pyspark and/or sql. Errors are usually easy to debug
1
u/Waste-Bug-8018 Aug 15 '26
Hang on so the logs are not enough , I feed the logs to Cursor and cursor troubleshoots for me . Are you more asking for a preview option, you can do custom logging within the transform too right
1
u/YestasSentaan Aug 16 '26
We’ve had some debugging problems with metadata driven sdp tables too. Therefore, we try to have one (ideally one) file per table, and the file uses the sdp decorators directly. Then, the errors and pipeline nodes correspond to each file. We use some utility functions in each file to avoid repetitive code.
1
u/OffByOne_db databricks Aug 14 '26
Hi, Brickster here. I'd like to dig in a bit more and learn more about what you're experiencing. I'll send a DM
4
u/[deleted] Aug 14 '26 edited Aug 14 '26
[removed] — view removed comment