|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
| 5 | + "metadata": { |
| 6 | + "collapsed": false, |
| 7 | + "jupyter": { |
| 8 | + "outputs_hidden": false |
| 9 | + } |
| 10 | + }, |
5 | 11 | "source": [
|
6 | 12 | "# Oracle Autonomous Database\n",
|
7 | 13 | "\n",
|
8 |
| - "Oracle autonomous database is a cloud database that uses machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by DBAs.\n", |
| 14 | + "Oracle Autonomous Database is a cloud database that uses machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by DBAs.\n", |
9 | 15 | "\n",
|
10 |
| - "This notebook covers how to load documents from oracle autonomous database, the loader supports connection with connection string or tns configuration.\n", |
| 16 | + "This notebook covers how to load documents from Oracle Autonomous Database.\n", |
11 | 17 | "\n",
|
12 | 18 | "## Prerequisites\n",
|
13 |
| - "1. Database runs in a 'Thin' mode:\n", |
14 |
| - " https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_b.html\n", |
15 |
| - "2. `pip install oracledb`:\n", |
16 |
| - " https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html" |
17 |
| - ], |
18 |
| - "metadata": { |
19 |
| - "collapsed": false |
20 |
| - } |
| 19 | + "1. Install python-oracledb:\n", |
| 20 | + "\n", |
| 21 | + " `pip install oracledb`\n", |
| 22 | + " \n", |
| 23 | + " See [Installing python-oracledb](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html).\n", |
| 24 | + "\n", |
| 25 | + "2. A database that python-oracledb's default 'Thin' mode can connected to. This is true of Oracle Autonomous Database, see [python-oracledb Architecture](https://python-oracledb.readthedocs.io/en/latest/user_guide/introduction.html#architecture).\n" |
| 26 | + ] |
21 | 27 | },
|
22 | 28 | {
|
23 | 29 | "cell_type": "markdown",
|
| 30 | + "metadata": { |
| 31 | + "collapsed": false, |
| 32 | + "jupyter": { |
| 33 | + "outputs_hidden": false |
| 34 | + } |
| 35 | + }, |
24 | 36 | "source": [
|
25 | 37 | "## Instructions"
|
26 |
| - ], |
27 |
| - "metadata": { |
28 |
| - "collapsed": false |
29 |
| - } |
| 38 | + ] |
30 | 39 | },
|
31 | 40 | {
|
32 | 41 | "cell_type": "code",
|
33 | 42 | "execution_count": null,
|
| 43 | + "metadata": { |
| 44 | + "collapsed": false, |
| 45 | + "jupyter": { |
| 46 | + "outputs_hidden": false |
| 47 | + } |
| 48 | + }, |
34 | 49 | "outputs": [],
|
35 | 50 | "source": [
|
36 | 51 | "pip install oracledb"
|
37 |
| - ], |
38 |
| - "metadata": { |
39 |
| - "collapsed": false |
40 |
| - } |
| 52 | + ] |
41 | 53 | },
|
42 | 54 | {
|
43 | 55 | "cell_type": "code",
|
44 | 56 | "execution_count": null,
|
| 57 | + "metadata": { |
| 58 | + "collapsed": false, |
| 59 | + "jupyter": { |
| 60 | + "outputs_hidden": false |
| 61 | + } |
| 62 | + }, |
45 | 63 | "outputs": [],
|
46 | 64 | "source": [
|
47 | 65 | "from langchain_community.document_loaders import OracleAutonomousDatabaseLoader\n",
|
48 | 66 | "from settings import s"
|
49 |
| - ], |
50 |
| - "metadata": { |
51 |
| - "collapsed": false |
52 |
| - } |
| 67 | + ] |
53 | 68 | },
|
54 | 69 | {
|
55 | 70 | "cell_type": "markdown",
|
56 |
| - "source": [ |
57 |
| - "With mutual TLS authentication (mTLS), wallet_location and wallet_password are required to create the connection, user can create connection by providing either connection string or tns configuration details." |
58 |
| - ], |
59 | 71 | "metadata": {
|
60 |
| - "collapsed": false |
61 |
| - } |
| 72 | + "collapsed": false, |
| 73 | + "jupyter": { |
| 74 | + "outputs_hidden": false |
| 75 | + } |
| 76 | + }, |
| 77 | + "source": [ |
| 78 | + "With mutual TLS authentication (mTLS), wallet_location and wallet_password parameters are required to create the connection. See python-oracledb documentation [Connecting to Oracle Cloud Autonomous Databases](https://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connecting-to-oracle-cloud-autonomous-databases)." |
| 79 | + ] |
62 | 80 | },
|
63 | 81 | {
|
64 | 82 | "cell_type": "code",
|
65 | 83 | "execution_count": null,
|
| 84 | + "metadata": { |
| 85 | + "collapsed": false, |
| 86 | + "jupyter": { |
| 87 | + "outputs_hidden": false |
| 88 | + } |
| 89 | + }, |
66 | 90 | "outputs": [],
|
67 | 91 | "source": [
|
68 | 92 | "SQL_QUERY = \"select prod_id, time_id from sh.costs fetch first 5 rows only\"\n",
|
|
89 | 113 | " wallet_password=s.PASSWORD,\n",
|
90 | 114 | ")\n",
|
91 | 115 | "doc_2 = doc_loader_2.load()"
|
92 |
| - ], |
93 |
| - "metadata": { |
94 |
| - "collapsed": false |
95 |
| - } |
| 116 | + ] |
96 | 117 | },
|
97 | 118 | {
|
98 | 119 | "cell_type": "markdown",
|
99 |
| - "source": [ |
100 |
| - "With TLS authentication, wallet_location and wallet_password are not required.\n", |
101 |
| - "Bind variable option is provided by argument \"parameters\"." |
102 |
| - ], |
103 | 120 | "metadata": {
|
104 |
| - "collapsed": false |
105 |
| - } |
| 121 | + "collapsed": false, |
| 122 | + "jupyter": { |
| 123 | + "outputs_hidden": false |
| 124 | + } |
| 125 | + }, |
| 126 | + "source": [ |
| 127 | + "With 1-way TLS authentication, only the database credentials and connection string are required to establish a connection.\n", |
| 128 | + "The example below also shows passing bind variable values with the argument \"parameters\"." |
| 129 | + ] |
106 | 130 | },
|
107 | 131 | {
|
108 | 132 | "cell_type": "code",
|
109 | 133 | "execution_count": null,
|
| 134 | + "metadata": { |
| 135 | + "collapsed": false, |
| 136 | + "jupyter": { |
| 137 | + "outputs_hidden": false |
| 138 | + } |
| 139 | + }, |
110 | 140 | "outputs": [],
|
111 | 141 | "source": [
|
112 | 142 | "SQL_QUERY = \"select channel_id, channel_desc from sh.channels where channel_desc = :1 fetch first 5 rows only\"\n",
|
|
131 | 161 | " parameters=[\"Direct Sales\"],\n",
|
132 | 162 | ")\n",
|
133 | 163 | "doc_4 = doc_loader_4.load()"
|
134 |
| - ], |
135 |
| - "metadata": { |
136 |
| - "collapsed": false |
137 |
| - } |
| 164 | + ] |
138 | 165 | }
|
139 | 166 | ],
|
140 | 167 | "metadata": {
|
141 | 168 | "kernelspec": {
|
142 |
| - "display_name": "Python 3", |
| 169 | + "display_name": "Python 3 (ipykernel)", |
143 | 170 | "language": "python",
|
144 | 171 | "name": "python3"
|
145 | 172 | },
|
146 | 173 | "language_info": {
|
147 | 174 | "codemirror_mode": {
|
148 | 175 | "name": "ipython",
|
149 |
| - "version": 2 |
| 176 | + "version": 3 |
150 | 177 | },
|
151 | 178 | "file_extension": ".py",
|
152 | 179 | "mimetype": "text/x-python",
|
153 | 180 | "name": "python",
|
154 | 181 | "nbconvert_exporter": "python",
|
155 |
| - "pygments_lexer": "ipython2", |
156 |
| - "version": "2.7.6" |
| 182 | + "pygments_lexer": "ipython3", |
| 183 | + "version": "3.12.11" |
157 | 184 | }
|
158 | 185 | },
|
159 | 186 | "nbformat": 4,
|
160 |
| - "nbformat_minor": 0 |
| 187 | + "nbformat_minor": 4 |
161 | 188 | }
|
0 commit comments