Mapping CSV responses
- Last Updated: July 22, 2024
- 2 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
- Values are mapped to a single table
- Arrays are mapped as strings in a single value
- Quoted, double-quoted, and escaped values are detected and processed by the driver. When mapping quoted values, the value has its quotation marks removed and is mapped as a literal value. For double-quoted and escaped values, the value has its external quotation marks and escapes removed and is mapped as a literal value, including any interior quotation marks.
- The following delimiters are supported: commas (
,), tabs, pipes (|), colons (:), and semicolons (;).
For example, the following CSV document contains an escaped value in the
NAME column and a quoted array in the VEHICLES column.
resident_id|name|street|city|state|county|pets|vehicles
ajx363|Sydney Smith|101 Main Street|Raleigh|NC|Wake|dog/beagle/35|"car,boat,bicycle"
tzn525|\"Cora" Welch\|191 First Street|Chapel Hill|NC|Orange|pig/yorkshire/55|"scooter,truck,bicycle"
When generating the relational view, the driver maps native objects into a
single table. Columns names are derived directly from the first entry of values in the
document, for example name maps to NAME. Escaped
values, such as \"Cora" Welch\, are mapped without their escapes, but
retain capitalization, spacing, and punctuation. For example, "Cora"
Welch. Similarly, quoted values have their external quotation marks
removed, but are persisted as literal values in the relational map. For example,
"car,boat,bicycle" is mapped as
car,boat,bicycle.
Primary keys for parent tables are determined heuristically from the top-level fields in
the document. For example, resident_id. However, if none of the fields
are determined to be viable candidates, the driver generates a primary key column,
ROWID. See "Determining the primary key" for more information. If
necessary, you can designate a new primary key in a parent table using the Configuration
Manager. See "Customizing your Schema" for details.
https://example.com/residents/2, the table would be named residents_2 by default. URL_ parent table by default. You can specify
a different table name using the Table property. 1, is appended to the relational name of an object. For
example, if your table contains an object that would normally map to
POSITION, your object would map column
POSITION_1 to avoid a conflict with the column used for
composite keys. The table for our example is named RESIDENTS_2 and takes the following form:
| RESIDENT_ID (PK) | NAME | STREET | CITY | STATE | COUNTY | PETS | VEHICLES |
|---|---|---|---|---|---|---|---|
| ajx363 | Sydney Smith | 101 Main street | Raleigh | NC | Wake | dog/beagle/35 | car,boat,bicycle |
| tzn525 | Cora Welch | 191 First street | Chapel Hill | NC | Orange | pig/yorkshire/55 | scooter,truck,bicycle |