Video : Oracle REST Data Services (ORDS) : REST Enabled SQL

Today’s video is a run through the REST Enabled SQL functionality in Oracle REST Data Services (ORDS).

I wasn’t originally planning on doing this video yet, but the subject of REST Enabled SQL came up a couple of times in the last few days, so I thought I would alter my schedule.

This video is based on the following article, where you can find a lot more examples than are present in the video.

Pretty print JSON strings in Oracle 12.2 the easy way

Uncategorized
| Oct 10, 2019
Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates. It turns out that in Oracle 12.2 you can easily get pretty printed large JSON strings using a query like this: select json_query(large_json_value, '$' returning clob pretty) as json_clob from some_table; Note however that the syntax returning clob pretty is not mentioned in the

Merge json files using Pandas

Quick demo for merging multiple json files using Pandas –

import pandas as pd
import glob
import json

file_list = glob.glob("*.json")
>>> file_list
['b.json', 'c.json', 'a.json']

Use enumerate to assign counter to files.


allFilesDict = {v:k for v, k in enumerate(file_list, 1)}
>>> allFilesDict
{1: 'b.json', 2: 'c.json', 3: 'a.json'}

Append the data into list –

>>> data = []

for k,v in allFilesDict.items():
    if 1  (more...)

Making Longer Lists

For very long lists, we need the return values to be CLOBs. Alas, LISTAGG can only return VARCHAR2 lists, but XML and JSON aggregate functions can return CLOBs!

JSON, the Euro symbol and a WE8MSWIN1252 character set database

Uncategorized
| Jul 30, 2019
Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates. Trying to parse a JSON_OBJECT_T string containing the € (euro) character on a WE8MSWIN1252 12.2.0.1.0 database returns the following error:   declare j json_object_t; begin j := json_object_t.parse('{"currency":"€"}'); end; /   ORA-40441: JSON syntax error ORA-06512: at "SYS.JDOM_T",

Houston, we’ve got a problem with JSON PUT method

Uncategorized
| Jul 3, 2019
Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates. In brief, in Oracle 12.2.0.1 there is some problem with PUT method of JSON_OBJECT_T, for some reason numbers are not recognized as such, but they are stored as scalar. The workaround is to use JSON_OBJECT_T.PARSE in combination with JSON_OBJECT SQL function for entering numbers (see the

JSON get_Date() method always discards time portion

Uncategorized
| May 16, 2019
Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates. In case you wonder why you don't see the time portion when you call the method get_Date() on a JSON object: -- tested on Oracle 12.2.0.1.0 set serveroutput on declare l_job_description JSON_OBJECT_T; l_job_params JSON_ARRAY_T; l_job_arr_elem JSON_OBJECT_T; begin

Understanding Nested Lists Dictionaries of JSON in Python and AWS CLI


After lots of hair pulling, bouts of frustration, I was able to grasp this nested list and dictionary thingie in JSON output of AWS cli commands such as describe-db-instances and others. If you run the describe-db-instances for rds or describe-instances for ec2, you get a huge pile of JSON mumbo-jumpo with all those curly and square brackets studded with colons and commas. The output is heavily nested.


For example, if you do :

aws rds (more...)

named tuple to JSON – Python

In pgdb – PostgreSQL DB API, the cursor which is used to manage the context of a fetch operation returns list of named tuples. These named tuples contain field names same as the column names of the database query.

An example of a row from the list of named tuples –


Row(log_time=datetime.datetime(2019, 3, 20, 5, 41, 29, 888000, tzinfo=), user_name='admin', connection_from='72.20.208.64:21132', command_tag='INSERT', message='AUDIT: SESSION,1,1,WRITE,INSERT,TABLE,user.demodml,"insert into user.demodml (id) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(11);",',  (more...)

limit IOs by instances

This is a follow up to my previous post.

I had to answer if I can limit the (IO) resources a DB instance can utilize. Unfortunately, in a simple instance I can not do so. It can be done in PDBs, but right now PDBs are out of scope.
So a simpler approach was developed: limiting IOs by creating cgroups.

There are 2 steps:

  1. disks
  1. create a proper cgroup
  2. get all related devices for (more...)

Documented JSON Classes

Looking through the PeopleTools 8.57 Feature Overview document, you may have noticed that 8.57 now includes support for several JSON classes as well as PeopleBooks documentation. As Chris Malek showed us a couple of years ago, the classes listed in the Feature Overview document are not new. What is new is the keyword Support and PeopleBooks documentation. Using the documentation, I was able to generate a sample on PeopleTools 8.57:

Local  (more...)

Schema-on-what? How to model JSON

How do you make sense out of schema-on-read? This post shows you how to turn a JSON document into a relational data model that any modeler or relational database person could understand.

101 Ways to Process JSON with PeopleCode

... well... maybe not 101 ways, but there are several!

There is a lot of justified buzz around JSON. Many of us want to (or must) generate and parse JSON with PeopleSoft. Does PeopleSoft support JSON? Yes, actually. The Documents module can generate and parse JSON. Unfortunately, many of us find the Documents module's structure too restrictive. The following is a list of several alternatives available to PeopleSoft developers:

Using the Slack webhook API from PL/SQL

Slack is a web-based chat room popular with many companies. Slack also has an API that can be used to post messages to a given "channel" or chat room. The simplest API offered is the "webhook" integration, which is "a simple way to post messages from external sources into Slack. They make use of normal HTTP requests with a JSON payload that includes the message text and some options."



To create a new Slack (more...)

Pivot Table plugin for APEX (Updated)

Some years ago I created an APEX region plugin for displaying the results of a query as a Pivot Table. You can read the original blog post about that here.

The plugin proved quite popular, but people were having problems using it with APEX 5 due to a jQuery versioning conflict.

I've now updated the plugin so it works with APEX, both 5.0 and 5.1.



To use it, simply add a region to (more...)

JSON_TABLE and the Top 2000

Oracle database 12c provides native JSON parsing. It is relatively easy to go from data in a JSON format to a relational representation.
In this example I will use data from the Top 2000. Every year in The Netherlands a playlist is produced by popular vote and fully broadcast between Christmas and the last day of the year, with the number one being played just before the New Year. You can see the complete list (more...)

Oracle and the Autonomous Database (a personal perspective from afar)

Yeah, if you hadn’t seen that one coming, hmmm, what can I say… Lot’s of…

Getting Started with REST Enabled SQL

Uncategorized
| Sep 7, 2017
POST a query or DML or DDL or even a short script over HTTPS to ORDS and have ORDS run that on your Oracle Database and have the results returned in JSON. That's the plan.

What You Need To Know

REST Enabled SQL uses Schema Authentication as well First Party Authentication.  



This means you can run SQL against an Oracle Database if the following is true.
  • REST Enabled SQL is enabled in ORDS
  • A (more...)

New! REST Enabled SQL for ORDS

Uncategorized
| Sep 7, 2017

The Oracle REST Data Service provides REST access to your Oracle Database. Tables, predefined queries and PL/SQL blocks can be exposed as RESTful services. This is great when you can foresee what table, query or action you wish to REST enable.

Starting in ORDS 17.3 you can now POST the query, pl/sql or sql*plus statement to ORDS at run time. This new feature is call REST Enabled SQL and it is built into ORDS (more...)

Oracle Developer Cloud for Deployment Automation of PHP Applications

This blog will give an understanding of deploying a simple PHP based REST service project on Oracle Application Container Cloud using Oracle Developer Cloud. This post will show the essentials for the PHP project for maintaining, building Nodejs code on Developer Cloud Service and deploying from Developer Cloud to Application Container Cloud.

 

Tech Stack Usage

Eclipse: IDE for PHP development.

Grunt: Tool for building the PHP code archive for deployment.

Oracle Developer Cloud: For (more...)