tortoise / tortoise/tortoise-orm
Support for Composite Primary Keys / Postgres Partitioning
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Is your feature request related to a problem? Please describe.
I have a set of data that requires table partitioning, and I have looking to implement partitioning support for Tortoise & Aerich. Currently, Postgres requires the partitioned field to be part of the primary key. Each table that I have has an ID UUID field that functions as the primary key. For the tables that I would like to partition, I am manually modifying the generated SQL so that the table has a composite PK that includes the partitioning field.
Describe the solution you'd like
The ability to declare composite primary keys - Or - a method for creating partitioned tables in Postgres.
Describe alternatives you've considered
Right now, I am manually modifying the generated SQL so that the table includes the partition by clause in addition to the composite PK.
I am using AFTER INSERT table signals to generate the necessary table partitions for the child partitioned tables.
This works, but requires manual work to maintain. A native solution would be preferred.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points; begin by locating the schema-generation and Aerich migration areas responsible for generated SQL. Clarify whether the project will support composite primary keys, PostgreSQL partitioned tables, or both, and define completion around native generation and maintenance without manual SQL changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100