On Thu, Aug 29, 2019, at 8:55 AM, Stephan Gerhard wrote:
> Hi,
> 
> I am wondering whether it is possible to use Alembic to define a migration 
> where I add a partitioned table - a feature that is supported in Postgres 12 
> - e.g. using range partitions.
> https://www.2ndquadrant.com/en/blog/partitioning-enhancements-in-postgresql-12/
> 
> How would I write this as an Alembic migration?

you would use op.execute():

e.g.

def upgrade():
 op.execute(
 "CREATE TABLE data_values_4_10 PARTITION OF data_values "
 "FOR VALUES FROM (4) TO (10)"
 )

https://alembic.sqlalchemy.org/en/latest/ops.html?highlight=op%20execute#alembic.operations.Operations.execute



> 
> Thanks,
> Stephan
> 

> --
>  You received this message because you are subscribed to the Google Groups 
> "sqlalchemy-alembic" group.
>  To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/daf95468-30c4-4a3b-be7b-1cb158ef31cd%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy-alembic/daf95468-30c4-4a3b-be7b-1cb158ef31cd%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/be1a5503-e136-4f66-ba25-35f6bc3ebb40%40www.fastmail.com.

Reply via email to