Forum Stats

  • 3,852,814 Users
  • 2,264,140 Discussions
  • 7,905,150 Comments

Discussions

Upload JSON from object storage to ADW using python

I get below error, while trying to upload json file from object storage to ADW:

  cursor.execute(statement)

cx_Oracle.DatabaseError: ORA-06550: line 6, column 26:

PLS-00103: Encountered the symbol ":" when expecting one of the following:


  . ( ) , * @ % & = - + < / > at in is mod remainder not rem

  <an exponent (**)> <> or != or ~= >= <= <> and or like like2

  like4 likec between || multiset member submultiset


Code is below:


connection = cx_Oracle.connect(user=ADW_USERNAME,

                                  password=ADW_PASSWORD,

                                  dsn=ADW_DBNAME)

cursor = connection.cursor()

cursor.execute('drop table test_json')

cursor.execute('create table test_json (id number generated always as identity, json_data clob, check (json_data IS JSON))')

statement = """

BEGIN

 DBMS_CLOUD.COPY_DATA(

   table_name =>'test_json',

   credential_name =>'DEF_CRED_NAME',

    file_uri_list =>https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/n/idp0c2wo1mkb/b/bucket_test/o/test_sep_6.json,

   format => json_object('delimiter' value ',')

 );

END;

"""

cursor.execute(statement)

cursor.execute('commit')

Tagged: