Avro Snapshot Dataset Sink (Deprecated)

Note: Datasets and the Avro Snapshot Dataset Sink are deprecated and will be removed in CDAP 7.0.0.

A batch sink for a PartitionedFileSet that writes snapshots of data as a new partition. Data is written in Avro format. A corresponding Avro Snapshot Dataset source can be used to read only the most recently written snapshot.

This sink is used whenever you want access to a PartitionedFileSet containing exactly the most recent run's data in Avro format. For example, you might want to create daily snapshots of a database by reading the entire contents of a table, writing to this sink, and then other programs can analyze the contents of the specified file.

Configuration

Property

Macro Enabled?

Description

Property

Macro Enabled?

Description

Dataset Name

Yes

Required. Name of the PartitionedFileSet to which records are written. If it doesn't exist, it will be created.

Snapshot Base Path

Yes

Optional. Base path for the PartitionedFileSet. Defaults to the name of the dataset.

FileSet Properties

Yes

Optional. Advanced feature to specify any additional properties that should be used with the sink, specified as a JSON object of string to string. These properties are set on the dataset if one is created. The properties are also passed to the dataset at runtime as arguments.

Clean Partitions Older Than

Yes

Optional. Configures the sink to delete partitions older than a specified date-time after a successful run. If set, when a run successfully finishes, the sink will subtract this amount of time from the runtime and delete any delete any partitions for time partitions older than that. The format is expected to be a number followed by an 's', 'm', 'h', or 'd' specifying the time unit, with 's' for seconds, 'm' for minutes, 'h' for hours, and 'd' for days. For example, if the pipeline is scheduled to run at midnight of January 1, 2016, and this property is set to 7d, the sink will delete any partitions for time partitions older than midnight Dec 25, 2015.

Compression Codec

No

Optional. Determine the compression codec to use on the resulting data. Valid values are None, Snappy, and Deflate.

Default is None.

Output Schema

Yes

Required. The Avro schema of the record being written to the sink as a JSON object.

Example

This example will write to a PartitionedFileSet named users. It will write data in Avro format using the given schema. Every time the pipeline runs, the most recent run will be stored in a new partition in the PartitionedFileSet:

Property

Value

Property

Value

Dataset Name

users

Compression Codec

Snappy

 

Created in 2020 by Google Inc.