0

I have a column inside my orace database with type varchar2(256Byte). And now I wrote a webserver with web.py and cx_Oracle to do a query and fetch the result. The problem is I get no values for this column. But curiously it works for another column with the same type.

code:

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)

For json2 I get no values: [{'building_nr': 1314867, 'geometry': {'type': 'polygon', 'coordinates': None}, 'polygon_typ': 'BuildingWallSurface'},....

What is wrong?

Moehre
  • 151
  • 1
  • 4
  • 17

1 Answers1

0

Are you using the so-far unreleased version of cx_Oracle which has Oracle object support? See How to convert SDO_GEOMTRY in GeoJSON

Community
  • 1
  • 1
Christopher Jones
  • 9,449
  • 3
  • 24
  • 48