Posts

Showing posts with the label error logic

Featured Post

8 Ways to Optimize AWS Glue Jobs in a Nutshell

Image
  Improving the performance of AWS Glue jobs involves several strategies that target different aspects of the ETL (Extract, Transform, Load) process. Here are some key practices. 1. Optimize Job Scripts Partitioning : Ensure your data is properly partitioned. Partitioning divides your data into manageable chunks, allowing parallel processing and reducing the amount of data scanned. Filtering : Apply pushdown predicates to filter data early in the ETL process, reducing the amount of data processed downstream. Compression : Use compressed file formats (e.g., Parquet, ORC) for your data sources and sinks. These formats not only reduce storage costs but also improve I/O performance. Optimize Transformations : Minimize the number of transformations and actions in your script. Combine transformations where possible and use DataFrame APIs which are optimized for performance. 2. Use Appropriate Data Formats Parquet and ORC : These columnar formats are efficient for storage and querying, signif

Python Function: How to Write Error Logic

Image
Here's an example python user-defined function. Here, you'll know how to write error conditions. The best examples is if and else. I have shared the logic here for your reference. Python is one of the top programming languages. Python does support Functions . While writing functions you also need to consider some errors. Those are called exceptions. I am explaining how to give error logic in a function of Python. Exception-handling means to have logic for error scenarios. Writing exception I will show in a simple Function. In this post I will give you syntax for writing function and exception.  Here is my simple Function that multiplies two numbers. Logic to write Function in Python to Multiply Two Numbers  def product (num1,num2): prod=num1*num2 print( ' The product of the numbers is \t: '+str(prod) Parameters used the Python Function The 'def' means you are defining function with a name of 'product'. In the parameters of 'product', you can s