-
Notifications
You must be signed in to change notification settings - Fork 0
Implement s3 Delegation & Multipart Upload for files. #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eleftherioszisis
wants to merge
8
commits into
main
Choose a base branch
from
upload
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
049be97
Implement multipart upload for asset files
eleftherioszisis 3593622
Fix migration
eleftherioszisis efda936
Remove commented code
eleftherioszisis fd6593e
Account for pagination
eleftherioszisis cdfc0cf
Remove redundant error
eleftherioszisis fc756fe
Add comment
eleftherioszisis 4a5f8e5
Add tests
eleftherioszisis 39b437f
Rename endpoints to multipart-upload
eleftherioszisis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
alembic/versions/20260112_232724_ea6989325f62_s3_upload_delegation.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """s3_upload_delegation | ||
|
|
||
| Revision ID: ea6989325f62 | ||
| Revises: 642ef45b49c6 | ||
| Create Date: 2026-01-12 23:27:24.210332 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| from alembic_postgresql_enum import TableReference | ||
| from sqlalchemy.dialects import postgresql | ||
|
|
||
| from sqlalchemy import Text | ||
| import app.db.types | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "ea6989325f62" | ||
| down_revision: Union[str, None] = "642ef45b49c6" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.add_column( | ||
| "asset", sa.Column("upload_meta", postgresql.JSONB(astext_type=sa.Text()), nullable=True) | ||
| ) | ||
| op.sync_enum_values( | ||
| enum_schema="public", | ||
| enum_name="assetstatus", | ||
| new_values=["CREATED", "UPLOADING", "DELETED"], | ||
| affected_columns=[ | ||
| TableReference(table_schema="public", table_name="asset", column_name="status") | ||
| ], | ||
| enum_values_to_rename=[], | ||
| ) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.sync_enum_values( | ||
| enum_schema="public", | ||
| enum_name="assetstatus", | ||
| new_values=["CREATED", "DELETED"], | ||
| affected_columns=[ | ||
| TableReference(table_schema="public", table_name="asset", column_name="status") | ||
| ], | ||
| enum_values_to_rename=[], | ||
| ) | ||
| op.drop_column("asset", "upload_meta") | ||
| # ### end Alembic commands ### |
54 changes: 54 additions & 0 deletions
54
alembic/versions/20260112_232729_4d9640ae6ba0_update_triggers.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """Update triggers | ||
|
|
||
| Revision ID: 4d9640ae6ba0 | ||
| Revises: ea6989325f62 | ||
| Create Date: 2026-01-12 23:27:29.559400 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| from sqlalchemy import Text | ||
| import app.db.types | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "4d9640ae6ba0" | ||
| down_revision: Union[str, None] = "ea6989325f62" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.create_index( | ||
| "ix_asset_full_path", | ||
| "asset", | ||
| ["full_path"], | ||
| unique=True, | ||
| postgresql_where=sa.text("status != 'DELETED'"), | ||
| ) | ||
| op.create_index( | ||
| "uq_asset_entity_id_path", | ||
| "asset", | ||
| ["path", "entity_id"], | ||
| unique=True, | ||
| postgresql_where=sa.text("status != 'DELETED'"), | ||
| ) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_index( | ||
| "uq_asset_entity_id_path", | ||
| table_name="asset", | ||
| postgresql_where=sa.text("status != 'DELETED'"), | ||
| ) | ||
| op.drop_index( | ||
| "ix_asset_full_path", table_name="asset", postgresql_where=sa.text("status != 'DELETED'") | ||
| ) | ||
| # ### end Alembic commands ### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems very high, no?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these parameters need some fine tuning. These are the s3 limits. We may want to stay way below that.