Introduction to SQL with Python

Introduction to SQL with Python

Course Level: Intermediate (6 hours)

Using databases is a fundamental part of a data scientist’s role. This training course introduces SQL databases and the SQL command syntax, and shows how Python can be used to retrieve and manipulate data held in a relational database. The course also discusses how SQLAlchemy can be used to define and interact with databases using object-oriented Python code.

We use a PostgreSQL database as an example, and communicate with this using a psycopg2 connection.

Download course details

Book: Introduction to SQL with Python

Start Date:
Price:
Venue Details:
Time:
Duration:

No Events Currently Scheduled

Sorry, there are no upcoming events for this course, but please get in touch if you would like to be kept informed when events are scheduled in the future.

Course Details

Outline

  • Introduction to databases: An introduction to relational databases that implement the SQL standard.
  • Data entry and retrieval: Using Python as a means to query and modify data in a SQL database.
  • Standard SQL commands: Typical SQL commands when working with a database.
  • Pandas: Using Pandas to load database contents into DataFrame objects and vice versa.
  • Multiple tables: Dealing with and joining data that resides in multiple tables within a database.
  • Object-oriented programming: Using SQLAlchemy to define and interact with databases using object-oriented code.

Learning outcomes

Session 1:

By the end of session 1 participants will…

  • understand the concepts of relational database management.
  • be introduced to the PostgreSQL dialect.
  • understand how to form a connection using psycopg2.
  • have learned how to run basic SQL commands:
    • extracting data with SELECT statements
    • filtering and organising data
    • creating tables and inserting data
  • be able to use parameterised queries to insert Python data.

Session 2:

By the end of session 2 participants will…

  • be able to convert between SQL data and Pandas DataFrame formats.
  • have learned how to join tables by matching variables.
  • understand object-oriented database management with SQLAlchemy:
    • defining database tables using Python classes
    • inserting rows using class instances
    • constructing queries by chaining methods

This course does not include:

  • A thorough introduction to Pandas, see our Intro to Python course for this.
  • Database services by cloud providers like AWS and Azure, see our Intro to SQL course for an introduction.
  • Connecting to databases through other programming languages like R, see our Intro to SQL with R course for this.

Prior knowledge

No knowledge of database software is assumed, however familiarity with Python programming and Pandas DataFrames is required. Successful completion of the Introduction to Python course offered by Jumping Rivers is sufficient background. Basic knowledge of for loops and object-oriented programming in Python would also be useful, but not essential.

Materials Preview

Attendee Feedback

  • “Myles as an instructor is knowledgeable with good demo and time management.”