所以我在Python3.5上使用psycopg2将一些数据插入到postgresql数据库中.我想要做的是有两列是字符串,最后一列只是一个dict对象.我不需要搜索dict,只需能将其从数据库中取出并使用它.
例如:
uuid = "testName"
otherString = ""
dict = {'id':'122','name':'test','number':'444-444-4444'}
# add code here to store two strings and dict to postgresql
cur.execute('''SELECT dict FROM table where uuid = %s''', 'testName')
newDict = cur.fetchone()
print(newDict['number'])
Run Code Online (Sandbox Code Playgroud)
这是可能的,如果是这样,我该怎么做呢?