SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.66k stars 464 forks source link

postgres: Support creating partitioned tables #1962

Open gitmalong opened 8 months ago

gitmalong commented 8 months ago

Hi!

The TableCreateStatement does not support creating partitioned tables.

  1. Create partitioned table statement
CREATE TABLE measurement (
    city_id         int not null,
    logdate         date not null,
) PARTITION BY RANGE (logdate);
  1. Create partition statement
    CREATE TABLE measurement_y2006m02 PARTITION OF measurement
    FOR VALUES FROM ('2006-02-01') TO ('2006-03-01');

Reasoning:

Sponsored some beer (:

Thanks

tyt2y3 commented 7 months ago

Thank you for the sponsorship. I am not sure where there is an issue for PARTITION BY RANGE on sea-query. I'll assess the difficult / effort needed.

gitmalong commented 7 months ago

Hi. You're welcome. I created a corresponding issue: https://github.com/SeaQL/sea-query/issues/722

delbonis commented 3 months ago

I'm also interested in this. What are the blockers? And what would creating partitions with SeaORM in the meantime look like (I guess using .extra)?