Gehen Sie mit der App Player FM offline!
How to Set Up Session-Level Database Migrations in Python
Manage episode 518915889 series 3474159
This story was originally published on HackerNoon at: https://hackernoon.com/how-to-set-up-session-level-database-migrations-in-python.
Set up session-level async database migrations in Python using SQLAlchemy, Alembic, and pytest for cleaner, faster test environments.
Check more stories related to programming at: https://hackernoon.com/c/programming. You can also check exclusive content about #python-development, #asyncio, #sqlalchemy, #pytest-fixtures, #postgresql-async-engine, #alembic-migrations, #python-database-testing, #sqlalchemy-async-session, and more.
This story was written by: @art8x. Learn more about this writer by checking @art8x's about page, and for more stories, please visit hackernoon.com.
How to set up session-level database fixtures for testing in a Python application. It runs migrations once per session to improve efficiency. It demonstrates how to truncate all tables between tests using SQL TRUNCATE ... CASCADE, and how to properly dispose of the database manager afterward — ensuring a clean, reliable, and performant async DB testing environment.
432 Episoden
Manage episode 518915889 series 3474159
This story was originally published on HackerNoon at: https://hackernoon.com/how-to-set-up-session-level-database-migrations-in-python.
Set up session-level async database migrations in Python using SQLAlchemy, Alembic, and pytest for cleaner, faster test environments.
Check more stories related to programming at: https://hackernoon.com/c/programming. You can also check exclusive content about #python-development, #asyncio, #sqlalchemy, #pytest-fixtures, #postgresql-async-engine, #alembic-migrations, #python-database-testing, #sqlalchemy-async-session, and more.
This story was written by: @art8x. Learn more about this writer by checking @art8x's about page, and for more stories, please visit hackernoon.com.
How to set up session-level database fixtures for testing in a Python application. It runs migrations once per session to improve efficiency. It demonstrates how to truncate all tables between tests using SQL TRUNCATE ... CASCADE, and how to properly dispose of the database manager afterward — ensuring a clean, reliable, and performant async DB testing environment.
432 Episoden
All episodes
×Willkommen auf Player FM!
Player FM scannt gerade das Web nach Podcasts mit hoher Qualität, die du genießen kannst. Es ist die beste Podcast-App und funktioniert auf Android, iPhone und im Web. Melde dich an, um Abos geräteübergreifend zu synchronisieren.