[ckan-dev] Datastore field type confusion

Aaron D Borden aaron.borden at gsa.gov
Tue Apr 16 20:16:32 UTC 2019


Hello,

I'm wrestling with a bug in with one of our datasets where zip codes are
being parsed as numbers. This is problematic because a zip code like
`00501` becomes `501` after upload, which is not a valid zip code. I want
to change the zip code type to text, so leading zeros are not stripped.
However, I'm confused between the field types in datastore_info vs
datastore_create vs datastore_search.

The datastore_info API says the field is type `number`.

When you call datastore_search, the field type is listed as `numeric`.

And listed in the datastore field type documentation
<https://docs.ckan.org/en/2.5/maintaining/datastore.html?highlight=datastore#field-types>
for
datastore_create, is type `int`.

After calling datastore_create with `type: text` and re-uploading, the
leading zeros are still getting stripped and the type is still listed as
`number` or `numeric`. Can someone shed some light on this?

-- 
Aaron D Borden
Software Developer | IT Specialist
TTS | Data.gov <https://www.data.gov>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190416/30be6c9a/attachment.html>


More information about the ckan-dev mailing list