Skip to content

Remove DRF as a dependency #4877

@Anish9901

Description

@Anish9901

Description

Currently, the only place we're using Django REST Framework is for our file upload endpoint: api/db/v0/data_files.

We can simplify this by converting it to a regular Django view, which will make the codebase cleaner and much easier to work with.
We have already figured out how to handle file uploads with view while working on the bulk_insert/ endpoint.

Additionally, This removal would delete >1000 lines of code, along with an additional dependency drf-access-policy which we no longer use.

Affects users

None

Affects developers

Medium

  • Simplifies the file upload logic.
  • Removal of 1 major and 1 minor dependency we won't have to maintain.
  • Removal of outdated error handling systems.
  • No DRF magic, So, easy debugging.

Suggested change

  • Use a multipart form parser along with a django view, similar to how we do with bulk_insert/ to handle file uploads.
  • Remove DRF code imports and settings.

Additional context

This is a really low hanging fruit, that can be done in 1-2 hrs. A little bit of frontend changes might be required as there might be a change it the url of the endpoint when we get drf out of the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects: architectureImprovements or additions to architectureaffects: dxRelated to developer experienceaffects: technical debtImproves the state of the codebasehelp wantedCommunity contributors can implement thisreadyReady for implementationwork: backendRelated to Python, Django, and simple SQLwork: frontendRelated to frontend code in the mathesar_ui directory

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions