<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0" -->

---
title: Building Python applications with SQLAlchemy and Aurora DSQL
description: A step-by-step guide to connecting SQLAlchemy 2.x to Amazon Aurora DSQL using a veterinary clinic CLI app as the example. Covers three key adaptations...
canonical: https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building Python applications with SQLAlchemy and Aurora DSQL | daily.dev
og:description: A step-by-step guide to connecting SQLAlchemy 2.x to Amazon Aurora DSQL using a veterinary clinic CLI app as the example. Covers three key adaptations...
og:url: https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0
og:image: https://api.daily.dev/og/posts/HObYpiXp0.png
og:image:alt: Building Python applications with SQLAlchemy and Aurora DSQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Python applications with SQLAlchemy and Aurora DSQL

**[AWS Database Blog](https://daily.dev/sources/aws-database-blog)** · 8 min read · 0 upvotes · 0 comments

## Summary

A step-by-step guide to connecting SQLAlchemy 2.x to Amazon Aurora DSQL using a veterinary clinic CLI app as the example. Covers three key adaptations required: UUID primary keys (since Aurora DSQL recommends them for distributed workloads), application-level relationship definitions using `relationship()` with `primaryjoin` and `foreign()` annotations instead of `ForeignKey()` constraints (which Aurora DSQL does not support), and configuring the SQLAlchemy engine in AUTOCOMMIT mode to avoid unsupported SAVEPOINT operations. Also covers IAM authentication via the Aurora DSQL Python Connector, CRUD with eager loading, and OCC retry logic with exponential backoff for handling write conflicts.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://aws.amazon.com/blogs/database/building-python-applications-with-sqlalchemy-and-aurora-dsql>

## Similar posts on daily.dev

- [Building type-safe applications with Drizzle ORM in Aurora DSQL](https://daily.dev/posts/building-type-safe-applications-with-drizzle-orm-in-aurora-dsql-ysp70xb5v) · AWS Database Blog · 3 upvotes · 0 comments
- [Build a Spring Boot REST API with Amazon Aurora DSQL](https://daily.dev/posts/build-a-spring-boot-rest-api-with-amazon-aurora-dsql-n9w0d0wit) · AWS Database Blog · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building Python applications with SQLAlchemy and Aurora DSQL","url":"https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0"},"datePublished":"2026-06-08T20:12:17.715Z","dateModified":"2026-06-08T20:15:03.760Z","description":"A step-by-step guide to connecting SQLAlchemy 2.x to Amazon Aurora DSQL using a veterinary clinic CLI app as the example. Covers three key adaptations...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/56b10e8bc306c282dc280b594cd5451b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/56b10e8bc306c282dc280b594cd5451b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"AWS Database Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"AWS Database Blog","logo":"https://media.daily.dev/image/upload/s--En-avd2a--/f_auto,q_auto/v1780213446/logos/aws-database-blog?_a=BAMAMiWQ0","url":"https://daily.dev/sources/aws-database-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-python-applications-with-sqlalchemy-and-aurora-dsql-hobypixp0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AWS Database Blog","item":"https://daily.dev/sources/aws-database-blog"},{"@type":"ListItem","position":3,"name":"Building Python applications with SQLAlchemy and Aurora DSQL"}]}
```

