Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c63115f

Browse files
committedJul 23, 2024
Documentation for centralized config provider, JSON Relational Duality View and other updates with formatting improvements
1 parent 39bd3a1 commit c63115f

File tree

13 files changed

+813
-246
lines changed

13 files changed

+813
-246
lines changed
 

‎doc/src/.static/custom.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ li div.highlight-default.notranslate, li div.highlight-shell.notranslate, li div
5454
font-size: 11pt;
5555
font-weight: bold;
5656
}
57+
58+
/* Added code to override the default content width in ReadtheDocs and break long words */
59+
.wy-nav-content {
60+
max-width: none;
61+
word-break: break-word;
62+
}

‎doc/src/_ext/constants_table.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#------------------------------------------------------------------------------
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
#
4+
# This software is dual-licensed to you under the Universal Permissive License
5+
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
6+
# 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
7+
# either license.
8+
#
9+
# If you elect to accept the software under the Apache License, Version 2.0,
10+
# the following applies:
11+
#
12+
# Licensed under the Apache License, Version 2.0 (the "License");
13+
# you may not use this file except in compliance with the License.
14+
# You may obtain a copy of the License at
15+
#
16+
# https://www.apache.org/licenses/LICENSE-2.0
17+
#
18+
# Unless required by applicable law or agreed to in writing, software
19+
# distributed under the License is distributed on an "AS IS" BASIS,
20+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
# See the License for the specific language governing permissions and
22+
# limitations under the License.
23+
#------------------------------------------------------------------------------
24+
25+
#------------------------------------------------------------------------------
26+
# constants_table.py
27+
#
28+
# Defines a directive (constants-table) that creates a table with a specific
29+
# configuration on top of the extended "list-table-with-summary" directive.
30+
#------------------------------------------------------------------------------
31+
32+
from docutils.statemachine import ViewList
33+
34+
import table_with_summary
35+
36+
class ConstantsTable(table_with_summary.ListTableWithSummary):
37+
38+
def run(self):
39+
self.options["summary"] = \
40+
"The first column displays the name of the constant. The " \
41+
"second column displays the value of the constant. The third " \
42+
"column displays the description of the constant."
43+
self.options["header-rows"] = 1
44+
self.options["class"] = ["wy-table-responsive"]
45+
self.options["widths"] = [40, 15, 45]
46+
self.options["width"] = "100%"
47+
headings = ViewList(['* - Constant Name', ' - Value', ' - Description'])
48+
self.content = headings + self.content
49+
return super().run()
50+
51+
def setup(app):
52+
app.add_directive('constants-table', ConstantsTable)

‎doc/src/api_manual/connection.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ Connection Methods
676676
:class: wy-table-responsive
677677
:align: center
678678
:widths: 10 10 30
679+
:width: 100%
679680
:summary: The first column displays the name of the parameter. The second column displays the data type of the parameter. The third column displays the description of the parameter.
680681

681682
* - Parameter
@@ -842,7 +843,7 @@ Connection Methods
842843
:header-rows: 1
843844
:class: wy-table-responsive
844845
:align: center
845-
:widths: 10 10 20 30
846+
:widths: 10 15 20 25
846847
:summary: The first column displays the Node.js Type. The second
847848
column displays the Database type. The third column displays the
848849
Bind type value. The fourth column displays the notes.
@@ -972,7 +973,7 @@ Connection Methods
972973
:header-rows: 1
973974
:class: wy-table-responsive
974975
:align: center
975-
:widths: 5 10 35
976+
:widths: 10 10 30
976977
:summary: The first column displays the property. The second column
977978
displays the data type of the property. The third column displays
978979
the description of the property.
@@ -1511,7 +1512,8 @@ Connection Methods
15111512
:header-rows: 1
15121513
:class: wy-table-responsive
15131514
:align: center
1514-
:widths: 10 12 45
1515+
:widths: 10 10 30
1516+
:width: 100%
15151517
:summary: The first column displays the parameter. The second column
15161518
displays the data type of the parameter. The third column displays
15171519
the description of the parameter.
@@ -1712,7 +1714,8 @@ Connection Methods
17121714
:header-rows: 1
17131715
:class: wy-table-responsive
17141716
:align: center
1715-
:widths: 10 15 40
1717+
:widths: 10 10 30
1718+
:width: 100%
17161719
:summary: The first column displays the parameter. The second column
17171720
displays the data type of the parameter. The third column displays
17181721
the description of the parameter.
@@ -2257,6 +2260,7 @@ Connection Methods
22572260
:class: wy-table-responsive
22582261
:align: center
22592262
:widths: 10 10 30
2263+
:width: 100%
22602264
:summary: The first column displays the parameter. The second column
22612265
displays the data type of the parameter. The third column displays
22622266
the description of the parameter.
@@ -2814,6 +2818,7 @@ Connection Methods
28142818
:class: wy-table-responsive
28152819
:align: center
28162820
:widths: 10 10 30
2821+
:width: 100%
28172822
:summary: The first column displays the parameter. The second column
28182823
displays the data type of the parameter. The third column displays the
28192824
description of the parameter.

‎doc/src/api_manual/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ desupported features are listed first.
1515
:header-rows: 1
1616
:class: wy-table-responsive
1717
:align: center
18-
:widths: 10 25 20
18+
:widths: 20 20 15
1919
:width: 100%
2020
:summary: The first column displays the deprecated API method, property, or constant. The second column displays the node-oracledb version in which the API method, property, or constant was deprecated or desupported. The third column displays the API property, method, or constant to use instead, if applicable.
2121

‎doc/src/api_manual/lob.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Lob Methods
146146
:class: wy-table-responsive
147147
:align: center
148148
:widths: 15 30
149+
:width: 100%
149150
:summary: The first column displays the parameter. The second column
150151
displays the data type of the parameter. The third column displays
151152
the description of the parameter.

‎doc/src/api_manual/oracledb.rst

Lines changed: 30 additions & 237 deletions
Large diffs are not rendered by default.

‎doc/src/api_manual/pool.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ Pool Methods
668668
:header-rows: 1
669669
:class: wy-table-responsive
670670
:align: center
671-
:widths: 10 55
671+
:widths: 15 35
672+
:width: 100%
672673
:summary: The first column displays the name of the attribute. The
673674
second column displays the description of the attribute.
674675

‎doc/src/api_manual/sodadb.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ SodaDatabase Methods
337337
:class: wy-table-responsive
338338
:align: center
339339
:widths: 10 10 40
340+
:width: 100%
340341
:summary: The first column displays the parameter. The second column
341342
displays the data type of the parameter. The third column displays
342343
the description of the parameter.

‎doc/src/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
# Add any Sphinx extension module names here, as strings. They can be extensions
2323
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
24-
extensions = ["table_with_summary", "oracle_desupported", 'sphinx_rtd_theme']
24+
extensions = ["table_with_summary", "oracle_desupported", "constants_table",
25+
'sphinx_rtd_theme']
2526

2627
# Add any paths that contain templates here, relative to this directory.
2728
templates_path = ['.templates']

‎doc/src/user_guide/appendix_a.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ node-oracledb Thin and Thick modes. For more details see :ref:`modediff`.
284284
* - Oracle Database 21c JSON data type (see :ref:`json21ctype`)
285285
- Yes
286286
- Yes
287-
* - Oracle Database 23ai JSON duality view
287+
* - Oracle Database 23ai JSON-Relational Duality Views (see :ref:`jsondualityviews`)
288288
- Yes
289289
- Yes
290290
* - Oracle Database 23ai BOOLEAN data type (see :ref:`oracledbconstantsdbtype`)

‎doc/src/user_guide/connection_handling.rst

Lines changed: 625 additions & 0 deletions
Large diffs are not rendered by default.

‎doc/src/user_guide/json_data_type.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,83 @@ This produces::
443443
{"deptId":30,"name":"Purchasing"}
444444
{"deptId":40,"name":"Human Resources"}
445445

446+
.. _jsondualityviews:
447+
448+
JSON-Relational Duality Views
449+
=============================
450+
451+
Oracle Database 23ai JSON-Relational Duality Views allow data to be stored as
452+
rows in tables to provide the benefits of the relational model and SQL access,
453+
while also allowing read and write access to data as JSON documents for
454+
application simplicity. See the `JSON-Relational Duality Developer's Guide
455+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=JSNVU>`__ for more
456+
information.
457+
458+
For example, if the tables ``authorTable`` and ``bookTable`` exist::
459+
460+
CREATE TABLE authorTable (
461+
authorId NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
462+
authorName VARCHAR2(100)
463+
);
464+
465+
CREATE TABLE bookTable (
466+
bookId NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
467+
bookTitle VARCHAR2(100),
468+
authorId NUMBER REFERENCES authorTable (authorId)
469+
);
470+
471+
Then a JSON Duality View over the tables can be created using SQL*Plus::
472+
473+
CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW bookDV AS
474+
bookTable @insert @update @delete
475+
{
476+
_id: bookId,
477+
book_title: bookTitle,
478+
author: authorTable @insert @update
479+
{
480+
author_id: authorId,
481+
author_name: authorName
482+
}
483+
};
484+
485+
You can insert into JSON Duality Views using SQL*Plus::
486+
487+
INSERT INTO bookDV VALUES(
488+
'{"book_title": My Book",
489+
"author": {"author_name": "James"}}'
490+
);
491+
492+
Applications can choose whether to use relational access to the underlying
493+
tables, or use the duality view.
494+
495+
Inserting JSON into the view will update the base relational tables:
496+
497+
.. code-block:: javascript
498+
499+
const data = { "_id": 1000, "book_title": "My New Book",
500+
"author": { "author_id": 2000, "author_name": "John Doe" }};
501+
await connection.execute(
502+
`INSERT INTO bookDV VALUES (:bv)`,
503+
{ bv: {val: data, type: oracledb.DB_TYPE_JSON}
504+
);
505+
506+
You can use SQL/JSON to query the view and return JSON. The query uses the
507+
special column ``DATA``:
508+
509+
.. code-block:: javascript
510+
511+
const sql = `SELECT b.data.book_title, b.data.author.author_name FROM
512+
bookDV b WHERE b.data.author.author_id = :1`;
513+
const binds = [1];
514+
const options = {
515+
bindDefs: [ { type: oracledb.NUMBER } ]
516+
};
517+
const result = await connection.execute(sql, binds, options);
518+
console.log(result.rows);
519+
520+
This will print the book title and author name for the author whose id is
521+
``1``.
522+
446523
Portable JSON
447524
=============
448525

‎doc/src/user_guide/vector_data_type.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ BINARY format to define vectors. The BINARY format represents each dimension
215215
value as a binary value (0 or 1). Binary vectors require less memory storage.
216216
For example, a 16 dimensional vector with BINARY format requires only 2 bytes of
217217
storage while a 16 dimensional vector with INT8 format requires 16 bytes of
218-
storage. The BINARY vector support was introduced in node-oracledb 6.6.
218+
storage.
219+
220+
Binary vectors require the database initialization parameter `COMPATIBLE
221+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-A2E90F08-BC9F-
222+
4688-A9D0-4A948DD3F7A9>`__ to be set to 23.5.0.0.0 or greater on Oracle
223+
Database. The BINARY vector support was introduced in node-oracledb 6.6.
219224

220225
Binary vectors are represented as 8-bit unsigned integers. For the BINARY
221226
format, you must define the number of dimensions as a multiple of 8. To create

0 commit comments

Comments
 (0)
Please sign in to comment.