[Django] #34541: StorageRouter

4 views
Skip to first unread message

Django

unread,
May 4, 2023, 2:26:42 PM5/4/23
to django-...@googlegroups.com
#34541: StorageRouter
------------------------------------------------+------------------------
Reporter: Vasanth | Owner: nobody
Type: New feature | Status: new
Component: File uploads/storage | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
With the recent addition of STORAGES, would it it possible to have a
StorageRouter that mimics the functionality of the DatabaseRouter but for
files/storage classes.

Since the storage callable in Filefields are called during build,it cannot
be used to dynamically set the storage class during runtime.

This would be particularly useful for cases where data for specific models
needs to stored elsewhere or for SaaS backends provide independent and
isolated buckets for each coient/subdomain.

Related to #34540

--
Ticket URL: <https://code.djangoproject.com/ticket/34541>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 4, 2023, 2:30:23 PM5/4/23
to django-...@googlegroups.com
#34541: StorageRouter
-------------------------------------+-------------------------------------

Reporter: Vasanth | Owner: nobody
Type: New feature | Status: new
Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Vasanth:

Old description:

> With the recent addition of STORAGES, would it it possible to have a
> StorageRouter that mimics the functionality of the DatabaseRouter but for
> files/storage classes.
>
> Since the storage callable in Filefields are called during build,it
> cannot be used to dynamically set the storage class during runtime.
>
> This would be particularly useful for cases where data for specific
> models needs to stored elsewhere or for SaaS backends provide independent
> and isolated buckets for each coient/subdomain.
>
> Related to #34540

New description:

With the recent addition of STORAGES, would it it possible to have a
StorageRouter that mimics the functionality of the DatabaseRouter but for
files/storage classes.

Since the storage callable in Filefields are called during build, it
cannot be used to dynamically set the storage class during runtime.

However dynamically setting the storage class would be particularly useful


for cases where data for specific models needs to stored elsewhere or for
SaaS backends provide independent and isolated buckets for each

client/subdomain.

In case of fields that have a field level storage class and StorageRouter,
priority has to be resolved by the router.

Related to #34540

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34541#comment:1>

Django

unread,
May 4, 2023, 2:32:31 PM5/4/23
to django-...@googlegroups.com
#34541: StorageRouter
-------------------------------------+-------------------------------------
Reporter: Vasanth | Owner: nobody
Type: New feature | Status: new
Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Vasanth:

Old description:

> With the recent addition of STORAGES, would it it possible to have a
> StorageRouter that mimics the functionality of the DatabaseRouter but for
> files/storage classes.
>

> Since the storage callable in Filefields are called during build, it
> cannot be used to dynamically set the storage class during runtime.
>
> However dynamically setting the storage class would be particularly
> useful for cases where data for specific models needs to stored elsewhere
> or for SaaS backends provide independent and isolated buckets for each
> client/subdomain.
>
> In case of fields that have a field level storage class and
> StorageRouter, priority has to be resolved by the router.
>
> Related to #34540

New description:

With the recent addition of STORAGES, would it be possible to have a


StorageRouter that mimics the functionality of the DatabaseRouter but for

files/storage classes?

Since the storage callable in Filefields are called during build, it
cannot be used to dynamically set the storage class during runtime.

However dynamically setting the storage class would be particularly useful
for cases where data for specific models needs to stored elsewhere or for
SaaS backends provide independent and isolated buckets for each
client/subdomain.

In case of fields that have a field level storage class and StorageRouter,
priority has to be resolved by the router.

Related to #34540

--

--
Ticket URL: <https://code.djangoproject.com/ticket/34541#comment:2>

Django

unread,
May 4, 2023, 2:38:40 PM5/4/23
to django-...@googlegroups.com
#34541: StorageRouter
-------------------------------------+-------------------------------------
Reporter: Vasanth | Owner: nobody
Type: New feature | Status: closed

Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => wontfix


Comment:

If you need such as advanced structure you can implement
`settings.STORAGE` on your own as a subclass of `dict`.

If you don't agree, please
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow the triaging guidelines with regards to
wontfix tickets] and take this to DevelopersMailingList, where you'll
reach a wider audience and see what other think.

--
Ticket URL: <https://code.djangoproject.com/ticket/34541#comment:3>

Reply all
Reply to author
Forward
0 new messages