Skip to content
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

Array Field is not supported #7

Open
yvsssantosh opened this issue Aug 19, 2019 · 7 comments
Open

Array Field is not supported #7

yvsssantosh opened this issue Aug 19, 2019 · 7 comments
Labels
feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects

Comments

@yvsssantosh
Copy link

Requesting feature to support type ArrayField to allow the user to store data in an array.

@yvsssantosh
Copy link
Author

@rvinzent Kindly think about this and let me know if this can be achieved. I'll try to help if possible

@rvinzent
Copy link
Owner

rvinzent commented Oct 6, 2019

@yvsssantosh apologies for the delayed response. This sounds like a nice addition to the project 😄 . It should come with some checking to make sure array fields are supported by the database.

@rvinzent rvinzent added feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Oct 6, 2019
@rvinzent rvinzent added this to the 0.2.0 milestone Nov 16, 2019
@rvinzent rvinzent added this to To do in Features Nov 16, 2019
@arpitremarkable
Copy link
Contributor

arpitremarkable commented Apr 24, 2020

I think best way to implement this without building a complex logic to check whether database supports array fields or not will be to do it the way Django does.

  1. Firstly, the data_type argument should accept a special class_object
    something like
from dynamic_models import fields as dynamic_fields
color_field_schema = FieldSchema.objects.create(name='color', data_type=dynamic_fields.CharField(max_length=200)')
  1. Then, make a module specific to supported databases and put the ArrayField class there. Django example would be from django.contrib.postgres.fields import ArrayField
from dynamic_models.postgres.fields import ArrayField

This way, it's explicit and devs can make their own decision.

I know it's already implemented and will be release in 0.2.0 but I just wanted to give my suggestion.

Thanks for this lib

@dankgen-tobias
Copy link

dankgen-tobias commented May 6, 2020

@arpitremarkable

I know it's already implemented and will be release in 0.2.0

Where can you see that it is already implemented and that there is a version 0.2.0?

@arpitremarkable
Copy link
Contributor

@dankgen-tobias
I assumed it's done since author claimed somewhere that 0.2.0 will be released soon. And this is marked 0.2.0 candidate.

@rvinzent
Copy link
Owner

@arpitremarkable @dankgen-tobias 0.2.0 was released today and this feature unfortunately did not make it in. 0.2.0 is a big change to the API, but I wanted to limit the addition of new features in order to not delay the release any further.

Increased data type support is absolutely on the radar, and PRs are always appreciated!

@rvinzent rvinzent removed this from the 0.2.0 milestone May 17, 2020
@rvinzent rvinzent added the 0.3.0 label May 17, 2020
@rvinzent rvinzent removed the 0.3.0 label Sep 21, 2020
@rvinzent
Copy link
Owner

rvinzent commented Nov 10, 2020

  1. Firstly, the data_type argument should accept a special class_object
    something like
from dynamic_models import fields as dynamic_fields
color_field_schema = FieldSchema.objects.create(name='color', data_type=dynamic_fields.CharField(max_length=200)')

@arpitremarkable
The challenge with accepting Field instances as arguments is it's not entirely clear how to store that information in the database so it can be reconstructed later. It could be something like classname and kwargs fields, but kwargs would have to only contain serializable data types for values.

I like the idea though and it should be possible to implement and allow a lot more flexibility to the kinds of fields that can be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Features
  
To do
Development

No branches or pull requests

4 participants