Camptocamp – Schulungen

SQLAlchemy

SQLAlchemy is a toolbox and an ORM (Object Relational Mapper) to interact with Python and SQL databases. SQLAlchemy is very complete, very flexible and very efficient. Unlike other ORMs, SQLAlchemy does not try to hide SQL and the relational model of the database. SQLAlchemy offers an elegant syntax to describe a data model and generate SQL queries in Python.

This training allows you to discover systems „Core“ and „ORM“ SQLAlchemy and know how to use SQLAlchemy to define a relational data model and make requests of different types. The training provides all the basics for successful projects based on Python SQLAlchemy for communication with databases.

Goals

  • Introduction to SQLAlchemy
  • Know main functions of SQLAlchemy
  • Know how to use SQLAlchemy to implement typical SQL queries

Duration

  • 2 days

Targeted audience

  • Python developer looking for a library to interact with relational databases

Prerequisites

  • Intermediary level in Python

Program

  • Overall presentation of SQLAlchemy
    • Goal
    • Philosophy
    • Key-functions
    • Concepts
    • Architecture
    • Databases
  • First steps with SQLAlchemy
    • Connection to the database
    • Creation and handling of the « engine » object
    • Declaration et tables creation
    • „Metadata“
    • Create and execute simple SQL queries
  • ORM: the basics
    • Declare a mapping Class/Table
    • Create and use a « Session »
    • Insert objetcs
    • Select objects
    • Use SQL finctions
  • ORM: relations
    • Differents types of relations
    • Declare simple relations between tables
    • Work with objects linked by relations
    • Use joints
    • Notions oft « lazy » versus « eager » loading
    • Les relations « many to many »
  • ORM: Sessions in more details
    • Understand the goal and the functioning of Sessions
    • Understand good practices
  • Core: the basics
    • « ORM vs Core » discussion
    • Insertion expressions
    • Execution of queries
    • Selection expressions
  • Core: complex queries
    • Joins
    • Use of functions
    • Suppression and update expressions
  • Core: configuration of connections
    • Configure the « engine »
    • Transactions
    • Configure the « pool » of connections
  • Presentation of GeoAlchemy
    • Goals
    • Philosophy
    • Different versions
  • GeoAlchemy with ORM
    • Declare a geometrical column
    • Insert geometrical objects
    • Select geometrical objects
    • Executer spatial functions
  • GeoAlchemy with the « Core » part of SQLAlchemy
    • Insert geometrical objects
    • Select geometrical objects géométriques
    • Execute spatial functions

Réservation et contact