piccolo icon indicating copy to clipboard operation
piccolo copied to clipboard

IS there Array size support?

Open BezBartek opened this issue 2 years ago • 4 comments

Am I able to define Array size? I do not see it in docs anywhere, as well as in column type definition If that feature is absent, is it possible to add it in near future? Thanks!

BezBartek avatar Mar 03 '23 11:03 BezBartek

Yeah, it's not possible to specify the array size currently, but it would be a very simple change.

However, looking at the Postgres docs it doesn't seem to do anything with the array size.

Screenshot 2023-03-03 at 12 17 08

Does specifying the array size give any benefits besides documenting the intended size?

dantownsend avatar Mar 03 '23 12:03 dantownsend

I guess we could do some validation on Piccolo's side when someone passes in an array to make sure it's the required size.

dantownsend avatar Mar 03 '23 12:03 dantownsend

@dantownsend Ok, I didn't know that it does nothing on postgres level, I just compared it to Django, where I used to define the size of arrays. In my case, it would be hopeful cus it have to be always array of size 3, and now I will have to add validation of that myself

I think it would be nice to define it on the model level, cus configuration like that from a business perspective is part of the model schema

BezBartek avatar Mar 03 '23 14:03 BezBartek

Yeah, interesting idea. We could add validation to the Pydantic model too based on the array size.

dantownsend avatar Mar 03 '23 22:03 dantownsend