|
| 1 | +--- |
| 2 | +sidebar_position: 2 |
| 3 | +sidebar_label: Configuration |
| 4 | +description: |
| 5 | + "Reference documentation for the setup process for the Hasura Oracle connector, including connection URI details, and |
| 6 | + native queries." |
| 7 | +keywords: |
| 8 | + - oracle |
| 9 | + - configuration |
| 10 | +--- |
| 11 | + |
| 12 | +# Configuration Reference |
| 13 | + |
| 14 | +## Introduction |
| 15 | + |
| 16 | +The configuration is a metadata object that lists all the database entities — such as tables — that the data connector |
| 17 | +has to know about in order to serve queries. It never changes during the lifetime of the data connector service |
| 18 | +instance. When your database schema changes you will have to update the configuration accordingly, see |
| 19 | +[updating with introspection](#updating-with-introspection). |
| 20 | + |
| 21 | +## Structure |
| 22 | + |
| 23 | +The configuration object is a JSON object with the following fields: |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "jdbcUrl": "", |
| 28 | + "jdbcProperties": {}, |
| 29 | + "schemas": [], |
| 30 | + "tables": [], |
| 31 | + "functions": [], |
| 32 | + "nativeQueries": {} |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +### Property: JDBC URL |
| 37 | + |
| 38 | +The JDBC connection URL to connect to the Oracle database. This is a required field. |
| 39 | + |
| 40 | +The value can either be a literal string, or a reference to an environment variable: |
| 41 | + |
| 42 | +```json |
| 43 | +{ |
| 44 | + "jdbcUrl": "jdbc:oracle:thin:@//localhost:1521/xe?user=foo&password=bar", |
| 45 | + "jdbcUrl": { "variable": "ORACLE_JDBC_URL" } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +### Property: JDBC Properties |
| 50 | + |
| 51 | +This is a JSON object containing key-value pairs of additional properties to be passed to the JDBC driver. For example, |
| 52 | +with MySQL to enable running multiple statements in a given query: |
| 53 | + |
| 54 | +```json |
| 55 | +{ |
| 56 | + "jdbcProperties": { "allowMultiQueries": "true" } |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +### Property: Schemas |
| 61 | + |
| 62 | +This is an optional array of schema names to include in the introspection process. If not provided, all schemas will be |
| 63 | +included. |
| 64 | + |
| 65 | +Example: |
| 66 | + |
| 67 | +```json |
| 68 | +{ |
| 69 | + "schemas": ["public", "other_schema"] |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +### Property: Tables |
| 74 | + |
| 75 | +This is an array of table definitions, generated automatically during introspection. |
| 76 | + |
| 77 | +Example: |
| 78 | + |
| 79 | +```json |
| 80 | +{ |
| 81 | + "tableName": "Album", |
| 82 | + "tableType": "TABLE", |
| 83 | + "description": "", |
| 84 | + "columns": [ |
| 85 | + { |
| 86 | + "name": "AlbumId", |
| 87 | + "description": "", |
| 88 | + "type": "int", |
| 89 | + "numeric_scale": 0, |
| 90 | + "nullable": false, |
| 91 | + "auto_increment": true, |
| 92 | + "is_primarykey": true |
| 93 | + }, |
| 94 | + { |
| 95 | + "name": "Title", |
| 96 | + "description": "", |
| 97 | + "type": "varchar", |
| 98 | + "numeric_scale": null, |
| 99 | + "nullable": false, |
| 100 | + "auto_increment": false, |
| 101 | + "is_primarykey": false |
| 102 | + }, |
| 103 | + { |
| 104 | + "name": "ArtistId", |
| 105 | + "description": "", |
| 106 | + "type": "int", |
| 107 | + "numeric_scale": 0, |
| 108 | + "nullable": false, |
| 109 | + "auto_increment": false, |
| 110 | + "is_primarykey": false |
| 111 | + } |
| 112 | + ], |
| 113 | + "pks": ["AlbumId"], |
| 114 | + "fks": { |
| 115 | + "FK_AlbumArtistId": { |
| 116 | + "foreign_collection": "Artist", |
| 117 | + "column_mapping": { |
| 118 | + "ArtistId": "ArtistId" |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +### Property: Functions |
| 126 | + |
| 127 | +This is an array of function definitions. |
| 128 | + |
| 129 | +Example: |
| 130 | + |
| 131 | +```json |
| 132 | +{ |
| 133 | + "function_catalog": "public", |
| 134 | + "function_schema": "public", |
| 135 | + "function_name": "add", |
| 136 | + "argument_signature": "(N NUMBER, M NUMBER)", |
| 137 | + "data_type": "TABLE (N NUMBER, M NUMBER)", |
| 138 | + "comment": "Adds two numbers" |
| 139 | +} |
| 140 | +``` |
| 141 | + |
| 142 | +### Property: Native Queries |
| 143 | + |
| 144 | +This is a JSON object containing key-value pairs of Native Queries to be used in the data connector. |
| 145 | + |
| 146 | +Two types of Native Queries are supported: **Inline** and **Parameterized**. |
| 147 | + |
| 148 | +Example: |
| 149 | + |
| 150 | +```json |
| 151 | +{ |
| 152 | + "native_query_inline": { |
| 153 | + "sql": { |
| 154 | + "parts": [ |
| 155 | + { |
| 156 | + "type": "text", |
| 157 | + "value": "SELECT 1 AS result FROM DUAL" |
| 158 | + } |
| 159 | + ] |
| 160 | + }, |
| 161 | + "columns": { |
| 162 | + "result": { |
| 163 | + "type": "named", |
| 164 | + "name": "INT" |
| 165 | + } |
| 166 | + }, |
| 167 | + "arguments": {}, |
| 168 | + "description": "" |
| 169 | + }, |
| 170 | + "ArtistById_parameterized": { |
| 171 | + "sql": { |
| 172 | + "parts": [ |
| 173 | + { |
| 174 | + "type": "text", |
| 175 | + "value": "SELECT * FROM CHINOOK.ARTIST WHERE ARTISTID = " |
| 176 | + }, |
| 177 | + { |
| 178 | + "type": "parameter", |
| 179 | + "value": "ARTISTID" |
| 180 | + } |
| 181 | + ] |
| 182 | + }, |
| 183 | + "columns": { |
| 184 | + "ARTISTID": { |
| 185 | + "type": "named", |
| 186 | + "name": "INT" |
| 187 | + }, |
| 188 | + "NAME": { |
| 189 | + "type": "nullable", |
| 190 | + "underlying_type": { |
| 191 | + "type": "named", |
| 192 | + "name": "STRING" |
| 193 | + } |
| 194 | + } |
| 195 | + }, |
| 196 | + "arguments": { |
| 197 | + "ARTISTID": { |
| 198 | + "description": null, |
| 199 | + "type": { |
| 200 | + "type": "named", |
| 201 | + "name": "INT" |
| 202 | + } |
| 203 | + } |
| 204 | + }, |
| 205 | + "description": null, |
| 206 | + "isProcedure": false |
| 207 | + } |
| 208 | +``` |
| 209 | + |
| 210 | +## Updating with introspection |
| 211 | + |
| 212 | +Whenever the schema of your database changes you will need to update your data connector configuration accordingly to |
| 213 | +reflect those changes. |
| 214 | + |
| 215 | +Running `update` in a configuration directory will do the following: |
| 216 | + |
| 217 | +- Connect to the database with the specified `jdbcUrl`, and then overwrite all data in the `tables` field |
| 218 | + |
| 219 | +- Fill in default values for any fields absent from the configuration |
0 commit comments