[PyGreSQL] inserting JSON data

2019-08-23 Thread Justin Pryzby
I understand that INSERT and SELECT value (without ::type) might need to be specially casted, otherwise they end up as text. I'd never needed to do this before and was surprised to see that I needed to pass a types=['json'], or call json.dumps() to make it work at all. Specifically, I thought it

[PyGreSQL] acceslerate get_simple_type

2019-08-23 Thread Justin Pryzby
For me, on both py27 and py35 (which I don't otherwise use), it's ~50% faster to try:return dict[key]; except: pass than to test dict.get(). At least for the common case of "key in dict". d=dict(a=1) for i in range(1,99): #x = d.get('a') #if x is not None: print (d['a'])