Does Web2py Postgres Adapter support JSON as native type ?

205 views
Skip to first unread message

Mandar Vaze

unread,
May 4, 2014, 1:23:07 PM5/4/14
to web...@googlegroups.com
I looked at the gluon/dla.py - and it seems native_json is set to true only for MongoDBAdapter (Default value in BaseAdapter is False)

Postgres supports native datatype JSON since 9.3 (9.2?)
But PostgresAdapter maps JSON DAL type to TEXT for PostgresAdapter

1. What am I missing (if anything) because Web2py does not support JSON as native data type ?
2. There seems to be postgres:psycopg2 and postgres2:psycopg2 in the adapter list (Neither seems to support native type JSON) - but which one should I use ?  Is there a choice, or does web2py automatically select one for me (based on what ?)

Thanks,
-Mandar

Niphlod

unread,
May 4, 2014, 2:54:24 PM5/4/14
to web...@googlegroups.com
the postgres2 adapter is a proof of concept for working with arrays, it's not stable nor tested. stick to postgres.

the default adapter for postgres first checks the version of the backend and then updates the mappings to the proper type is json "native" support is available.

Mandar Vaze / मंदार वझे

unread,
May 8, 2014, 3:05:44 AM5/8/14
to web...@googlegroups.com
Niphlod,

Thanks for your answer.
Just to clarify that I have understood "I need not worry, Web2py DAL code will pick the right/correct adapter for me, and will support native JSON"

Cool !!

-Mandar


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/lYZ-et59-o0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niphlod

unread,
May 8, 2014, 8:33:13 AM5/8/14
to web...@googlegroups.com
yep, that's right.

Anthony

unread,
May 8, 2014, 8:55:57 AM5/8/14
to web...@googlegroups.com
And here's where it happens in the code: https://github.com/web2py/web2py/blob/master/gluon/dal.py#L2886

Anthony
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

Mandar Vaze / मंदार वझे

unread,
May 9, 2014, 3:05:23 PM5/9/14
to web...@googlegroups.com
On Thu, May 8, 2014 at 6:25 PM, Anthony <abas...@gmail.com> wrote:

Thanks for pointing the relevant piece of code.
Definitely helps !!!

-Mandar
Reply all
Reply to author
Forward
0 new messages