Skip to content

Commit

Permalink
init docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WSPluta committed Apr 11, 2024
1 parent 3047c3a commit 77dd43c
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
51 changes: 47 additions & 4 deletions README_ords.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,58 @@ pip install -r requirements.txt

Now, we're ready to start working.

## 1. ORDS Overview
## 1. ORDS Overview and setup

Oracle REST Data Services (ORDS) is a bridge between HTTP and Oracle Databases. In our case, we will be consuming an ORDS endpoint (hosted in the database that contains all F1 laps) and, therefore, we will be able to use this data as soon as it gets to the bastion.

In this case, we will use some data from RedBull Racing laps in the F1 eSports game. See `data/redbull_data.json` for an example of what kind of data we will be storing in our database.
In this case, we will use some data from [F1 eSports game](https://www.ea.com/en-gb/games/f1/f1-23). See `data/f1gamed_data.json` for an example of what kind of data we will be storing in our database.

Therefore, all F1 laps are stored into the database, and we are able to consume all these laps from an ORDS endpoint.
Therefore, all F1 game laps are stored into the database, and we are able to consume all these laps from an ORDS endpoint.

1. In order to *manually* consume the endpoint, we can run the following command:
For a full ORDS setup guide please visit [this page](https://docs.oracle.com/en/database/oracle/apex/23.2/htmig/configuring-ords.html#GUID-D688F4D6-FCAB-4C4D-BA6D-9A3506B3E05F).

To recreate the F1 eSports Ingestion and Analytics you can follow [this guide](https://apexapps.oracle.com/pls/apex/f?p=133:180:13122153387920::::wid:3708)

Here is how you can use ORDS to create API end point.

- Login to APEX Workspace and navigate to SQL Workshop

![SQL Workshop](./img/ords/1sqlworkshop.png)

- Activate ORDS inside RESful Services

![RESTful Services](./img/ords/2restfulservices.png)

- Click Create Module in Modules section

![Create Module](./img/ords/3modules.png)

- Fill in necessary fields in Module Definition section and click Apply Changes, then click on Create Template from Resource Templates section at the bottom of the page

![Module Definition](./img/ords/4moduledefinition.png)

- Add URI Template, and click on Apply Changes, after that click on Create Handler from Resource Handlers section at the bottom of the page

![Module Definition](./img/ords/5resourcetemplate.png)

- Choose GET method and change Source Type to Media Resource

![Module Definition](./img/ords/6resourcehandler.png)

Create JSON object definition in Source section, here is an example of how you can structure your query:

```sql
SELECT 'application/json',
JSON_OBJECT('OBJECT NAME' VALUE (
SELECT JSON_ARRAYAGG(JSON_OBJECT(*) RETURNING CLOB)
FROM (
SELECT * FROM 'TABLE.NAME'
)
) RETURNING CLOB) AS CD
FROM DUAL
```

- To *manually* consume the endpoint, we can run the following command:

```bash
# obfuscated since it's an unauthenticated rest endpoint
Expand Down
Binary file added img/ords/1sqlworkshop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ords/2restfulservices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ords/3modules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ords/4moduledefinition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ords/5resourcetemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/ords/6resourcehandler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 77dd43c

Please sign in to comment.