I am migrating my existing postgres database to sql alchemy. For this I am using alembic. So far I have created models for my existing tables. I have some permissions granted to my existing schemas and tables using Grant query. Now, when I run the alembic auto generate command it is creating something like this -
from alembic import op
from alembic_utils.pg_grant_table import PGGrantTable
def upgrade() -> None:
user_insert = PGGrantTable(schema='discovery', table='account', columns=['id','updated_date', 'validity_end_date'], role='user', grant='INSERT', with_grant_option=True)
op.drop_entity(user_insert)
def downgrade() -> None:
awsuser_insert= PGGrantTable(schema='discovery', table='account', columns=['id','updated_date', 'validity_end_date'], role='user', grant='INSERT', with_grant_option=True)
op.create_entity(user_insert)
How can I migrate the existing grant commands using alembic, such that when I run the alembic revision --autogenerate -m "Base" command, the upgrade and downgrade functions are empty.