PostgreSQL is a database that has many built-in data types to make it easier to query and process data. In this talk, we will look at the overlap between some of the built-in Python and PostgreSQL data types. We will explore the psycopg2 PostgreSQL adapter and see how it conveniently maps data types between PostgreSQL and Python, and look at how we can extend this to some popular Python ORMs.
PostgreSQL is a powerful relational database system that has many different data types and functions built into the core to make it easier to query and process complex data sets. Some of these data types are what you would expect: strings, numerical types, dates and times, etc. But PostgreSQL has some data types that are not common in database software, such as arrays, range types, network address types, XML and JSON support, and more.
In this talk, we will look at the overlap between some of the primitive Python data types and PostgreSQL data types. We will explore some of the built-in functionality of PostgreSQL and the ease-of-use of manipulating different data types, such as dates and times, arrays, and ranges. We will then dive into the psycopg2 PostgreSQL adapter and see how its built-in features enable us to conveniently map PostgreSQL data types to Python. Finally, we will extend these methodologies to some popular Python object-relational mappers and also see how these techniques work in practice.