我的orace数据库中有一个列,类型为varchar2(256Byte)。 现在我用web.py和cx_Oracle编写了一个webserver来进行查询并获取结果。 问题是我没有为此列获取任何值。但奇怪的是,它适用于另一个具有相同类型的列。
代码:
import cx_Oracle
import json
import web
urls = (
"/", "index",
"/grid", "grid",
)
app = web.application(urls, globals())
web.config.debug = True
connection = cx_Oracle.Connection("TEST_3D/limo1013@10.40.33.160:1521/sdetest")
typeObj = connection.gettype("MDSYS.SDO_GEOMETRY")
class index:
def GET(self):
return "hallo moritz "
class grid:
def GET(self):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
web.header('Content-Type', 'application/json')
cursor = connection.cursor()
cursor.arraysize = 100000 # default = 50
cursor.execute(
"""SELECT a.id , a.json2, d.Classname FROM building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d WHERE a.grid_id_500 = 2728 AND a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID""")
obj = cursor.fetchone()
print obj
result = []
for id, json2, classname in cursor:
result.append({
"building_nr":id,"geometry": {
"type":"polygon","coordinates":json2,}, "polygon_typ":classname,})
return result
if __name__ == "__main__":
app.run(web.profiler)
对于json2,我没有得到任何值: [{' building_nr':1314867,'几何':{'类型':'多边形','坐标':无},' polygon_typ':' BuildingWallSurface'},....
有什么问题?