Effective Serialization with Python

Effective Serialization with Python

1h 12mAdvanced2020-08-25

Authors

Miki Tebeka

Miki Tebeka

CEO at 353Solutions

Course details

When you're making calls between different services, you can use serialization to move data around in a predictable manner for easy encoding and decoding. In this course, instructor Miki Tebeka takes a deep dive into the subject of serialization with Python, exploring key serialization formats, how to work with each format, and how to pick the right one for your Python project. He covers Python-specific serialization formats such as marshal and pickle; how to serialize and deserialize using JSON; how to encode and decode messages and serialize using protocol buffers; how to use msgpack; and more. Along the way, he shares challenges that allow you to put your new knowledge to the test.

Skills covered

Programming FoundationsAdvancedPythonProgramming LanguagesOpen SourceSoftware Development

Concepts

Introduction

  • Serialization with Python
  • What you should know
  • Accessing the exercise files on GitHub

Serialization Overview

  • Why do we need serialization
  • Picking a serialization format
  • General serialization rules
  • Serialization formats overview

Python Specific Serialization Formats

  • Marshal and pickle serialization
  • Serialization with repr
  • Using eval and exec for serialization
  • Challenge - repr and read pickle
  • Solution - repr and read pickle

JSON Serialization

  • Basic JSON serialization
  • Serializing custom types to JSON
  • Streaming JSON
  • Challenge - Convert log records to JSON
  • Solution - Convert log records to JSON

Protocol Buffers Serialization

  • Protocol buffers overview
  • Writing the definition file
  • Generating serializers
  • Using protocol buffers
  • gRPC
  • Challenge - Trade objects size
  • Solution - Trade objects size

Other Serialization Formats

  • msgpack serialization
  • YAML serialization
  • XML serialization
  • SQL
  • Challenge - ETL from XML to database
  • Solution - ETL from XML to database

Unicode

  • What's Unicode
  • str and Bytes
  • Normalization
  • Case-insensitive comparison
  • Detect encoding
  • Challenge - Counting strings
  • Solution - Counting strings

Conclusion

  • Next steps
40,000 Toman