Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No values for varchar in cx_Oracle

limorAug 2 2016 — edited Aug 3 2016

Hi,

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?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2016
Added on Aug 2 2016
2 comments
762 views