If I understand correctly, you used Alembic's "autogenerate" feature to
create your migration script. This feature compares the table definitions
in your application with the table definitions in the database and then
generates a script to alter the database to match your application.

You can instruct alembic to ignore certain objects in the database using
either the "include_name" or "include_object" hooks:

https://alembic.sqlalchemy.org/en/latest/autogenerate.html#controlling-what-to-be-autogenerated

The first example there ("Omitting Table Names from the Autogenerate
Process") is probably what you want.

Hope that helps,

Simon

On Wed, Jun 8, 2022 at 3:15 PM Vishal Shimpi <vishal.shimpi...@gmail.com>
wrote:

> I am working on fastapi, in which i have created models and i am inteded
> to create the table in sql server database, however when i am runing my
> first migration, alembic detected removal of existing table which are not
> belongs to my work. Can somebody help how i can create my tables and avoid
> others tables to be removed and recreated again
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/3a89be66-24a0-4215-8b00-b4c11c52bbf9n%40googlegroups.com
> <https://groups.google.com/d/msgid/sqlalchemy/3a89be66-24a0-4215-8b00-b4c11c52bbf9n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAFHwexfFR%2Basd7oT8Lskimf-NqvDTs7cY--PLXf_5HQfrunwbw%40mail.gmail.com.

Reply via email to