We may earn an affiliate commission when you visit our partners.
Codestars • over 2 million students worldwide!, Jose Salvatierra, and Teclado by Jose Salvatierra

Master PostgreSQL and use it in your Python apps.

Python and PostgreSQL are two of the most in-demand skills in the world. After completing this course, you'll be confident in adding both to your resume/CV.

Everything you'll learn in this course is relevant to other database systems too, like MySQL, Microsoft SQL Server, or Oracle.

With this course, you'll master PostgreSQL and how to work with it from Python. If you use Python and you want to augment your skills with a database, you'll love this course.

You will:

Read more

Master PostgreSQL and use it in your Python apps.

Python and PostgreSQL are two of the most in-demand skills in the world. After completing this course, you'll be confident in adding both to your resume/CV.

Everything you'll learn in this course is relevant to other database systems too, like MySQL, Microsoft SQL Server, or Oracle.

With this course, you'll master PostgreSQL and how to work with it from Python. If you use Python and you want to augment your skills with a database, you'll love this course.

You will:

  • Work with different types of databases (in-memory, SQLite, and PostgreSQL), and understand when to use each in your Python apps.

  • Build a programming journal project to add a SQLite database to your Python application.

  • Improve a database design incrementally so you're not bound by your initial design.

  • Model different relationships with PostgreSQL, including one-to-many and many-to-many.

  • Reduce errors by applying database changes using database migrations with Python and alembic.

  • Build a polling app to learn about advanced data analysis with GROUP BY, PostgreSQL window functions, and nested queries.

  • Work with dates and times in PostgreSQL, and avoid common timezone pitfalls.

  • Structure Python apps like a professional, to make development much easier.

  • Produce data analysis reports and charts using matplotlib with PostgreSQL data.

You'll also tackle advanced PostgreSQL topics, such as:

  • User-Defined Functions

  • Stored Procedures

  • Locking

  • Async database connections

As you can see, you're going to learn a lot.

But this is a no-nonsense, no-frills course. We have planned, crafted, and edited every lecture to be concise and compact. No time wasted, so you can master PostgreSQL in record time.

We've created dozens of diagrams to explain database concepts, as well as code-along videos. But you won't just be watching me code. You'll develop the projects yourself first, to gain hands-on experience and master PostgreSQL.

Also, throughout the course, I provide data sets with challenges and exercises for you to practice what you've learned.

I've been teaching and helping students online for over 8 years, and this course is the culmination of my teaching experience. I know how to help you understand concepts fully and quickly, in the best way for you.

When you complete this course you'll be able to:

  • Extend your Python applications with database functionality using PostgreSQL.

  • Answer complex questions using data and generate reports.

  • List PostgreSQL as one of your strongest skills.

Check out the free preview videos for more information and to try out the course.

I'll see you on the inside.

Enroll now

What's inside

Learning objectives

  • How to leverage the power of databases (in-memory, sqlite, and postgresql) to upgrade your python applications
  • Prevent common pitfalls: avoid sql injection attacks, store database credentials securely, and optimize the performance of your applications
  • Understand how databases work and how to take advantage of their features from the ground up, by building multiple projects
  • This is a no-nonsense, no-frills course on fully mastering postgresql and how to use it effective within and outside of your python apps
  • Learn how to work with dates and times effectively in python applications
  • Produce engaging charts, graphs, and reports using database data

Syllabus

Introduction
Welcome to this course!
Initial setup (for newer Pythonistas)
Get the complete e-book here
Read more
A Full Python Refresher

This is a short introductory video to this section. I'm really excited to guide you through this Python refresher course!

This lecture has a link to all the Python code we'll write in this section. Use it to check your code as you write it, or to refresh your memory!

Let's look at variables in Python. Variables are just names for values, which we can reuse and reset.

Python is a dynamic typed language, which means variables don't need be constrained to a specific type.

String formatting in Python
Getting user input
Writing our first Python app

In this lecture we look at three essential data structures in Python: lists, tuples, and sets.

A list is an ordered collection of items.

A tuple is an immutable ordered collection of items.

A set is an unordered collection of unique items.

In this fascinating video, we look at advanced set operations: calculating items which are in two sets, or items which are in one set but not another.

Booleans in Python

This video explores how to create programs which can change depending on some input. For example, we might ask the user if they want to continue or not.

This makes use of boolean comparisons, such as:

  • 1 == 1 (which is True)

  • 5 > 5 (which is False)

The boolean comparisons we have available in Python are many:

  • ==

  • !=

  • >, <, <=, >=

  • is

  • is not

  • in

  • not in

The "in" keyword in Python
If statements with the "in" keyword

Loops allow us to repeat things over and over. This video explores two different types of loop in Python: for loop and while loop.

List comprehension is a relatively unique thing to Python.

It allows us to succinctly use a for loop inside a list to generate values. These values then end up in the list.

For example, [x for x in range(10)] generates a list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].

Dictionaries are an extremely useful thing in Python.

They are akin to sets, but instead of being a set of unique values, they are a set of unique keys, and each has a value associated with it.

Destructuring variables

In this video, let's look at methods in Python by creating some examples. Creating methods is simple, you just need the one keyword: def.

Function arguments and parameters
Default parameter values
Functions returning values
Lambda functions in Python
Dictionary comprehensions

*args and **kwargs are truly fascinatingly confusing. For eons, they have annoyed Python learners.

To this I say no more!

They're just a way of passing arguments.

Unpacking keyword arguments

Objects are the natural progression from dictionaries. Instead of just holding data, objects hold another special type of data: methods.

A method is a function which operates on the object calling it. Thus, an object can use its own values to calculate outputs of methods. Very cool.

Magic methods: _str_ and _repr_

In many instances, we don't want our methods to be solely referencing the object which calls them. Sometimes, we want to reference the class of the object. Other times, we don't need either the object or the class.

@classmethod and @staticmethod are two decorators (looking at that shortly!) which extend the capabilities of methods.

Classes in Python can also inherit from one another. This essentially means that a class contains all of the properties and methods of the class it inherits from—but with the added bonus that it can have more.

Class composition
Type hinting in Python 3.5+
Imports in Python
Relative imports in Python
Errors in Python
Custom error classes

Not only we can pass values from one method to another, but we can also pass functions.

This is not used very often, but it can sometimes yield very powerful methods in very few lines of code.

One of the most confusing aspects of Python for learners is the concept of decorators.

These are things we can place on top of function definitions which allow us to extend the function by executing code before and after the function.

They are extremely powerful when used well!

The 'at' syntax for decorators
Decorating functions with parameters

In this video we look at advanced decorators in Python, which is decorators that take arguments.

This amplifies the decorator's usefulness, although also makes them slightly more contrived.

Mutability in Python
Mutable default parameters (and why they're a bad idea)
Build a Programming Journal with Python & SQL
Overview of the project
Creating our user menu
What is SQL?
Using Python lists as an in-memory database
A SQLite data viewer
CREATE TABLE: new tables with SQL
How to write comments in SQL
CREATE TABLE exercises
How to connect to a SQLite database with Python
Connecting to SQLite in our app
What is a cursor?
INSERT INTO: add data to a table
INSERT INTO exercises
How to insert data into SQLite with Python
SELECT: retrieve data from a table
SELECT exercises
Retrieving results from a cursor
WHERE: search with SQL
WHERE exercises
DROP TABLE: deleting entire tables
DROP TABLE exercise
What is a SQL injection attack?
A Movie Watchlist App with Python & SQL
Three development stages of our project
Our starting code for this project
Queries we'll need for the project to begin with
Write the database.py file
UPDATE: changing data with SQL
UPDATE exercises
Write our user menu and functions
Watched movies: second approach
DELETE FROM: removing rows with SQL
DELETE FROM exercises
Stage 2: watching movies
Relational data: primary and foreign keys
Relational data exercise
Watched movies: final approach
Stage 3: adding new watched movies
Auto-incrementing row IDs
Auto-incrementing exercise
JOIN: access two tables at once with SQL
Use JOINs to retrieve the movies a user has watched
Types of JOINs with examples
ORDER BY: sort the returned table
LIMIT: getting a certain number of rows
LIKE: flexible searching
What is an index in SQL?
Adding an index to our table for more efficient searching
Introduction to PostgreSQL: Migrating our App
SQLite vs. PostgreSQL
How to install PostgreSQL
How to run and access PostgreSQL

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Augments Python skills with database knowledge, which is essential for building robust and scalable applications that manage and process data effectively
Teaches how to produce data analysis reports and charts using matplotlib with PostgreSQL data, which is valuable for visualizing and interpreting data
Covers advanced PostgreSQL topics like user-defined functions, stored procedures, locking, and async database connections, which are crucial for building high-performance applications
Explores database migrations with Python and Alembic, which helps reduce errors when applying database changes and ensures smooth transitions
Requires installing PostgreSQL, which may involve some initial setup and configuration, potentially posing a hurdle for beginners unfamiliar with database management systems
Uses SQLite as an in-memory database, which is useful for development and testing but may not fully represent the complexities of a production PostgreSQL environment

Save this course

Save The Complete Python/PostgreSQL Course 2.0 to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in The Complete Python/PostgreSQL Course 2.0 with these activities:
Review Python Fundamentals
Reinforce your understanding of Python syntax, data structures, and control flow to prepare for using Python with PostgreSQL.
Browse courses on Python Basics
Show steps
  • Review Python data types and operators.
  • Practice writing functions and classes.
  • Work through basic Python exercises.
Review 'Python Crash Course'
Solidify your Python knowledge with a comprehensive guide that covers the fundamentals and provides practical examples.
Show steps
  • Read the chapters on basic Python syntax and data structures.
  • Complete the exercises at the end of each chapter.
  • Focus on the sections related to working with data.
Build a Simple To-Do List App with SQLite
Gain hands-on experience with database interactions by building a simple application using SQLite, a lightweight database, before moving to PostgreSQL.
Show steps
  • Design the database schema for the to-do list.
  • Implement CRUD operations (Create, Read, Update, Delete) using Python and SQLite.
  • Create a user interface for interacting with the app.
Four other activities
Expand to see all activities and additional details
Show all seven activities
SQL Query Exercises
Sharpen your SQL skills by practicing various query types, including SELECT, INSERT, UPDATE, DELETE, and JOIN operations.
Show steps
  • Find online resources with SQL exercises.
  • Work through exercises of increasing complexity.
  • Focus on exercises involving JOINs and subqueries.
Document Your Learning Journey
Reinforce your understanding by creating blog posts or documentation summarizing key concepts and challenges encountered during the course.
Show steps
  • Choose a platform for documenting your learning.
  • Write regular entries summarizing key concepts.
  • Document any challenges and solutions you encounter.
Read 'PostgreSQL Up and Running'
Deepen your understanding of PostgreSQL with a practical guide that covers installation, configuration, and advanced features.
Show steps
  • Read the chapters on PostgreSQL architecture and configuration.
  • Experiment with different SQL commands and data types.
  • Explore advanced features like stored procedures and triggers.
Extend the Polling App with User Authentication
Enhance the polling app built during the course by adding user authentication and authorization features using PostgreSQL.
Show steps
  • Design the database schema for user accounts and roles.
  • Implement user registration, login, and logout functionality.
  • Implement access control based on user roles.

Career center

Learners who complete The Complete Python/PostgreSQL Course 2.0 will develop knowledge and skills that may be useful to these careers:
Python Developer
A Python developer specializes in developing applications using the Python programming language. This role often entails working with various databases, handling database interactions, and ensuring efficient data retrieval. This course, since it focuses on how to connect PostgreSQL to Python applications, can be an invaluable resource for a Python developer. The course also covers essential database concepts, including modeling relationships, and using advanced database features in PostgreSQL. A Python developer who wants real-world experience will benefit greatly from the hands on approach.
Backend Developer
A backend developer works on the server side of applications, handling data storage, logic, and APIs. The role involves working with databases, often choosing the right type of database for the task. This course teaches PostgreSQL, a widely used database system, and how it interfaces with Python applications, a crucial skill for a backend developer. Furthermore, the curriculum covers diverse database types, including in-memory and SQLite which provides a strong foundation for various projects. This course is an excellent resource for backend developers who aim to add database competencies to their skill set by learning how to connect Python applications to databases.
Full-Stack Developer
A full stack developer handles both front-end and back-end development, making them proficient in databases and application logic. This course will be invaluable for a full stack developer as it covers both Python and PostgreSQL, two critical technologies. The course offers skills in database design, database migrations, and efficient database usage from within Python applications. A full stack developer will make use of the practical experience gained in project development, which includes structuring professional-grade Python applications. Learning how to use databases with Python is an essential step for anyone in this career field, making this course a perfect fit.
Database Administrator
A database administrator is responsible for the performance, integrity, and security of databases. This role often involves designing databases, implementing database changes, and ensuring data is accessible and secure. This course helps build a strong foundation in database management, particularly with PostgreSQL, a skill highly valued in the field. Specifically, learners will understand how to use database migrations, handle date and time issues, and optimize database performance, skills essential for a database administrator. The course teaches how to work with in-memory, SQLite, and PostgreSQL databases, providing a comprehensive background applicable to various database environments, making this course particularly useful.
Software Developer
A software developer designs, develops, and tests software applications, and they often work with databases when building applications. This course is particularly useful for a software developer because it focuses on how to integrate PostgreSQL into Python applications. It covers essential database concepts, including different types of databases, modeling relationships, and implementing changes using database migrations. This course, which provides practical experience through project building, can help a software developer learn how to use Python and databases to build robust systems.
Application Developer
An application developer designs and builds software applications for various purposes. This role often requires solid database and development skills. This course can be an excellent fit because it teaches how to build full applications using Python and PostgreSQL, including the database interactions necessary to have a complete system. This course teaches how to model different relationships with PostgreSQL, apply database changes, and structure professional-grade Python applications. An application developer will find this course particularly relevant.
Data Analyst
Data analysts explore and interpret data to identify trends, patterns, and insights to inform decision-making. A large part of the role involves querying, data analysis, and creating data visualizations. This course is particularly relevant because it teaches advanced data analysis techniques within PostgreSQL, including window functions, GROUP BY, and nested queries. Moreover, learning to connect Python with PostgreSQL and create data visualizations with matplotlib, as taught in this course, are essential skills for a a data analyst. This makes the course an ideal choice.
Data Engineer
A data engineer designs, builds, and manages the infrastructure for data storage and processing. The role often requires working with various types of databases and creating efficient systems. This course can be especially useful for a data engineer because it provides in-depth knowledge of PostgreSQL, a common database technology. Also, the course emphasizes practical skills like database migrations, handling dates and times, and optimizing queries, skills which are critical for a data engineer who is setting up database infrastructure. This course may be useful when building a foundation in data systems.
Business Intelligence Analyst
A business intelligence analyst uses data to derive insights and make recommendations to improve business operations. Gathering, analyzing, and presenting data effectively is a large part of this job. This course helps a business intelligence analyst by providing skills to extract data from PostgreSQL, perform analyses with Python, and create visualizations through matplotlib. The use of window functions and nested queries learned in the course is a key skill for this role. This course may be most helpful in improving expertise in data analysis and presentation.
Data Scientist
A data scientist uses advanced techniques including machine learning and statistical methods to analyze data and solve complex problems. The role involves data extraction, cleaning, and analysis, often using databases. This course may be useful for a data scientist because it teaches how to connect Python applications to PostgreSQL to retrieve and analyze data. The course also covers advanced data analysis with GROUP BY, window functions, and nested queries. A data scientist may benefit in working with databases as a result of taking this course.
Systems Analyst
A systems analyst studies an organization's computer systems and procedures, and designs solutions to improve efficiency. They analyze data to make recommendations regarding technology. This course helps a systems analyst by providing a practical working knowledge of PostgreSQL and how it interfaces with Python applications. The course also covers concepts like database design and different types of databases which can inform decisions regarding database usage. The course may be useful in informing design and recommendations of database solutions.
Software Architect
A software architect designs the high level structure of a software system. They must decide on technology choices and ensure that different systems work well together. This course helps a software architect by providing a deep dive into PostgreSQL and how it integrates with Python. The course also covers different database types, which will be useful in designing systems that require data storage. The software architect may choose to use knowledge from this course to make better decisions about database technology.
Machine Learning Engineer
A machine learning engineer develops and implements machine learning models. The role involves working with large datasets and often requires efficient data handling and database knowledge. This course may be useful for a machine learning engineer because it teaches how to connect Python applications to databases like PostgreSQL, which may be used in the process of training models. The course teaches how to query and extract data from a database efficiently. A machine learning engineer can benefit from a greater knowledge of database interaction.
Technical Consultant
A technical consultant provides expertise on technology to clients, often helping them to improve systems and processes. This role requires a broad understanding of various technologies and how they can be effectively used in different scenarios. This course can be helpful by providing a deep understanding of PostgreSQL, a widely used relational database, and how it integrates with Python. The course also teaches how to connect to databases, extract data, and optimize queries, which are important skills for a technology consultant. This course may be useful for providing advice regarding data systems.
Research Scientist
A research scientist conducts scientific studies and experiments, often involving data collection and analysis. This role may require working with databases, handling large datasets, and understanding how to retrieve data efficiently. This course teaches how to connect Python and PostgreSQL, allowing for data extraction, which is important to the analysis process. Learning how to optimize queries and create visualizations may be helpful. The course may be useful for scientific research.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in The Complete Python/PostgreSQL Course 2.0.
Provides a comprehensive introduction to PostgreSQL, covering installation, configuration, and basic SQL commands. It's a valuable resource for understanding the fundamentals of PostgreSQL and how to use it effectively. It is useful as a reference tool for the course. It adds more depth to the existing course.
Provides a solid foundation in Python programming, covering essential concepts and syntax. It's particularly useful for beginners or those looking to refresh their Python skills before diving into database interactions. The project-based approach helps solidify understanding through practical application. It serves as a valuable reference for the Python aspects of the course.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser