Re: Paritioned Table Migration

2019-08-29 Thread Mike Bayer


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 sqlalchemy-alembic+unsubscr...@googlegroups.com.
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/daf95468-30c4-4a3b-be7b-1cb158ef31cd%40googlegroups.com
>  
> .

-- 
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 sqlalchemy-alembic+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/be1a5503-e136-4f66-ba25-35f6bc3ebb40%40www.fastmail.com.


Re: Paritioned Table Migration

2019-08-29 Thread Stephan Gerhard
Thanks!

Am Donnerstag, 29. August 2019 16:16:28 UTC+2 schrieb Mike Bayer:
>
>
>
> 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 sqlalchemy-alembic+unsubscr...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/daf95468-30c4-4a3b-be7b-1cb158ef31cd%40googlegroups.com
>  
> 
> .
>
>
>

-- 
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 sqlalchemy-alembic+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/f2c0cfa4-71ec-4de7-9a76-c1f485aff57f%40googlegroups.com.