Appendix C. Data Format

The SymmetricDS Data Format is used to stream data from one node to another. The data format reader and writer are pluggable with an initial implementation using a format based on Comma Separated Values (CSV). Each line in the stream is a record with fields separated by commas. String fields are surrounded with double quotes. Double quotes and backslashes used in a string field are escaped with a backslash. Binary values are represented as a string with hex values in "\0xab" format. The absence of any value in the field indicates a null value. Extra spacing is ignored and lines starting with a hash are ignored.

The first field of each line gives the directive for the line. The following directives are used:

version, {major},{minor},{patch}

Indicates the version of the file format

table, {table name}

Sets the context of which table on which to operate.

keys, {column name...}

Lists the column names that are used as the primary key for the table. Only needs to occur after the first occurrence of the table.

columns, {column name...}

Lists all the column names (including key columns) of the table. Only needs to occur after the first occurrence of the table.

insert, {column value...}

Insert into the table with the values that correspond with the columns.

update, {new column value...},{old key value...}

Update the table using the old key values to set the new column values.

delete, {old key value...}

Delete from the table using the old key values.

version, 1,0,0
table, item_selling_price
keys, price_id
columns, price_id, price, cost
insert, 55, 0.65, 0.55
table, item
keys, item_id 
columns, item_id, price_id, name
insert, 110000055, 55, "Soft Drink"
delete, 110000001
table, item_selling_price
update, 55, 0.75, 0.65, 55

Example C.1. Data Format Stream