Comma-Separated Values: Write To CSV File Adapter.

A Write To CSV File adapter writes received rows to a CSV output file.

Property Name (screen)

Property Name (Attach Adapter)

Type

Description

Filename

Filename

String

The name and path of the CSV file to write data to. You canspecify a file name and path either by typing it in or by clicking on the Browse button for this field. The CSV file name definition follows the format defined by regular expression. By default, the path is relative to the server's Base Folder and must be underneath that base folder, but you can use $ProjectFolder to specify a path relative to the current project folder. For more information, see Setting The Base Folder For File Input/Output Adapters. For more information about the Browse and Edit buttons, see the discussion that follows this table.

Maximum Size in bytes

MaximumSize

Integer Min: 1

The maximum size of the output file. If this property is set, the adapter starts writing a new file every time the size of the current output file becomes greater than this property. The files are named <filename>, <filename>.001, <filename>.002, and so on, where <filename> is the value of the Filename property.

Append To Existing File

Append

Boolean

This parameter affects how the adapter behaves when the adapter re-starts.

In all cases, when the adapter writes to a file and the size of the file reaches the size specified in the MaximumSize parameter described above, the adapter renames <Filename> to <Filename>.###, where "###" is the next available number. The adapter then opens another file named <filename> and writes to it.

If "Append To Existing File" is set to False, then when the adapter is (re-)started, the adapter moves any existing file named <Filename> to <Filename>.### and starts a new file named <Filename>.

If a maximum size is specified and "Append To Existing File" is set to True, then when the adapter is (re-)started, the adapter appends to any existing file named <Filename> rather than immediately renaming the existing file.

Set timestamp to current time

UseCurrentTimestamp

Boolean

If set to true, the adapter overrides the timestamp specified in the row with the current system time. Defaults to false.

Write title row

TitleRow

Boolean

If set to true, the adapter adds a title row to the output. The title row lists the column names.

Write timestamp column

TimestampColumn

Boolean

If set to true, the adapter writes the message timestamps in the first column of the file.

Timestamp column format

TimestampColumnFormat

String

The Timestamp column format specifies the format of the row timestamp column, for example, 'YYYY/MM/DD HH24:MI:SS.FF TZD'. If no timestamp format is specified, the adapter assumes that the timestamp is represented as a number of microseconds from 00:00:00 Jan 1, 1970 UTC/GMT. For more information, see Reading, Writing, and Converting Timestamps.

Flush each row

FlushAfterEachRow

Boolean

If set to true, the adapter writes each row to disk as soon as possible. If set to false, the adapter can wait until multiple rows are ready to be written to disk and then write them as a group. Flushing after each row may reduce overall performance.

CSV delimiter string

CsvDelimeterString

String

The character that separates columns in the output. Defaults to a comma (,).

Enable DL (Dynamic Loading)

EnableDynamicLoading

Boolean Default: False

When enabled, the CSV input adapter will use a dynamic loading function and the filename will be ignored. When unchecked, the CSV input adapter will use the original behavior to read data from a specified file.

DL Source Directory

Source Directory

String

The full path of source directory where the CSV file(s) get dynamically loaded into the CSV adapter.

DL File Name Format

DLFileNameFormat

String

The regular expression definition for the CSV file names to be loaded up.

DL Check Interval

CheckInterval

Long Min: 1 Default: 60

The next check interval for the adapter when no more files need to be processed, in seconds.

Note: The CSV files are loaded up periodically from an accessible folder that has been predefined, in the order of the creation date time stamp.

The Adapter Properties screen in Sybase CEP Studio allows you to specify an input path and file name for the file by clicking the Browse button and identifying the file. The path is relative to the adapters base folder, either as specified for Sybase CEP Server running on the same computer as Sybase CEP Studio, or as specified in the preferences for Sybase CEP Studio. For more information, see Setting The Base Folder For File Input/Output Adapters. In order for this feature to work properly, make sure that the Adapter's Base Folder field in Sybase CEP Studio Settings is set to the same folder as the adapters base folder for Sybase CEP Server. The Base Folder setting for the Sybase CEP Server is specified during the installation process, and can be changed later in the Sybase CEP Server's c8-server.conf file. The base folder setting for Sybase CEP Studio may be set from the Tools->Settings command on the Sybase CEP Studio menu.

The edit button brings up an editor that will allow you to view any file whose name you enter into the filename field. If the file's extension is "csv" or "xml", Studio brings up the appropriate editor specified in the "External Tools" tab available from the menu item "Tools -> Settings". For files with other extensions, on Microsoft Windows the editor is the one specified by the operating system's file associations and on UNIX-like operating systems Sybase CEP Studio opens the editor specified by the EDITOR environment variable.

Note:

When you click the Edit button, Sybase CEP Studio looks for the file in the SybaseC8Repository, even if the adapters base folder is set to another location. You may need to use the Browse button (adjacent to the Edit button) to navigate to the desired directory before you try to open the file.

Unless specified otherwise, the format of TIMESTAMP values (including the row timestamp) inside the CSV file is a 64-bit signed integer representing the number of microseconds since the beginning of the epoch (midnight January 1, 1970 UTC/GMT).

When Sybase CEP Server writes INTERVAL values in CSV format, the values are always written as a 64-bit signed integer representing a number of microseconds.