XML Models
The connector models tables in CData Arc as XML. The modelling follows this structure:- A parent element identifies the table to insert into.
- Each child element corresponds to a column in the target table.
</> Code above the configuration pane. The following XML is a simplified example model for a table called Account, which is modeled as the XML element <Account>:
Id, account_c, AccountNumber, and AccountSource are columns in the Account table. When the connector processes an XML file that matches this structure, it automatically inserts the values from that XML into the Account table. When the connector queries the Account table, it outputs XML that matches this structure.
Batching Input
Batching Output
Child Tables
Child Table XML
The Input Mapping XML structure is multi-layered when inserting into parent and child tables. The following XML snippet is an example Input Mapping for two tables related by a foreign key:Account is the parent table and AccountPartner is the child table. When the connector processes an input XML file that matches this structure, it updates both tables and ensures that the keys linking the two records are the same.
Using the ref Attribute
Some columns in child tables are marked with a ref tag. This tag indicates that these columns correspond to the primary key in the parent table. After making the insert into the parent table, and before making the insert into the child table, the connector queries the parent table for the primary key of the record it just inserted. The connector then uses this value when inserting into the child table. This is useful when the primary key of the parent table is generated by . In this case, this column is not passed in as input XML, so the connector does not know the value of the column until after it has inserted the record into the parent table. In the XML model, theref attribute indicates that a column can be referenced later or that the value for a column should be read from another column in the mapping. In order to reference the value of columns that are generated by , the column element should include a ref attribute set to the reserved value LAST_INSERT_ID:
ref element to the name of the relevant column:
ref syntax instructs the connector to retrieve the id from the parent table after inserting, and then use that retrieved value as the id column in the child table.
Selecting From Child Tables
Only Process New or Changed Records
Using a Last Modified Column
Using a Custom Column
Pre-Processing and Post-Processing Queries
XML Attributes
Table Attributes
allColumns
insertQuery
outputResult
processChangesOnly
requireInput
selectQuery
table
upsertQuery
Column Attributes
aggregate
column
id
In a Select mapping, this tags the value of a column with an Id marker that can be referenced later in a child query using the syntax${#ID}. This is useful when a column value is needed in a child query where matching column names in multiple tables can create ambiguity in the selection.