Home icon

Building async Python applications with Tortoise ORM and Amazon Aurora DSQL

Database Blog



This article demonstrates building high-concurrency async Python applications using Tortoise ORM paired with Amazon Aurora DSQL, using a rideshare platform as an example.

  • Tortoise ORM is an async-native Python ORM with Django-like syntax that integrates seamlessly with Aurora DSQL's serverless architecture
  • Use UUID primary keys for distributed-friendly key generation and manage relationships as UUID columns to minimize optimistic concurrency control conflicts
  • Authenticate with short-lived IAM tokens via Boto3's DSQL client instead of static passwords; patch asyncpg's connection reset to skip unsupported advisory lock calls
  • Implement OCC retry logic with exponential backoff and jitter to handle serialization errors when concurrent transactions modify the same row
  • Execute each DDL statement individually through raw asyncpg connections since Aurora DSQL doesn't support multiple DDL statements per transaction
  • Deploy with TLS encryption, least-privilege IAM roles, VPC isolation, and connection pool tuning for production workloads

The combination of Tortoise ORM's native async coroutines and Aurora DSQL's serverless scalability provides a strong foundation for high-concurrency Python applications like rideshare platforms, delivery tracking, and real-time marketplaces.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Jun 8
2026
Building Python applications with SQLAlchemy and Aurora DSQL
Jul 28
2026
Building scalable applications on Amazon Aurora DSQL
Sep 3
2026
Amazon Aurora MySQL now supports multi-source replication and delayed replication
Aug 27
2026
Amazon Aurora DSQL now supports foreign key constraints

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.