This is not directly supported by Prisma. There is an open feature request that you could +1 here.
Best workaround for now would be to writes scripts that use the CLI commands.
Answer from Austin Crim on Stack OverflowI’ve been experimenting with building a large fastapi project for a client and recently started using prisma cli for managing my database migrations.
Prisma python has bindings to the rust based cli by prisma.io and the cli has been growing rapidly in the typescript community.
Do you think this is an easier solution to adopting sqlAlchemy and alembic for managing db and migrations with fastapi?
If you need more context someone has already produced a short tutorial on prisma python.
https://lewoudar.medium.com/alternatives-to-sqlalchemy-for-your-project-prisma-case-9df8ce037578
Note: Prisma python client is a small project supported by prisma.io but Prisma cli has been around for quite a while and loved by the typescript community.
» pip install prisma