Data Files
Delimiter Separated Values *.dsv
data files are used for importing test data during development or for defining static content for e.g. nomenclatures. The data file name has to be the same as the target table name. The delimiter uses the |
char, and the order of the data fields should be the same as the natural order in the target table.
Be careful when using static data in tables. Entity Services (generated by the templates) use sequence algorithm to identity columns starting from 1.
The automatic re-initialization of static content from the data file can be achieved when you create a *.dsv
file in your project.
To make it more flexible it is introduced semantic files as follows:
-
REPLACE (*.replace)
- the rows in the database table always correspond to the lines in the data file. Processing of this type of files means - first delete all the records in the database table and insert the rows from the file. This is the behavior of the initial format - DSV (*.dsv). The processing is triggered on restart of the App/Web Server or on publishing of the project containing these files. -
APPEND (*.append)
- the rows from these files are imported only once into the corresponding database tables. If the tables already contain some records the inserting is skipped. After the initial import the corresponding sequence is set to the max ID of the table, so that this table can be used afterwards as persistence storage for the e.g. standard CRUD JavaScript Services. -
DELETE (*.delete)
- if the file contains*
as the only line, the whole table is cleaned up. Otherwise only the listed records got deleted by the ID (first column = ID = primary key). -
UPDATE (*.update)
- the records in the database table got updated with the corresponding lines in the data files. The first column is theID = primary key
used as selection parameter for the update clause. The existing records in the table are not deleted in advance as at theREPLACE
case. If no record exist by the givenID
, it got inserted.
Samples
Data Structures and Data Files samples could be found here: