////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Add Sequence transform adds a sequence to the Hop stream. A sequence is an ever-changing integer value with a specific start and increment value. Sequences can be generated by Hop or retrieved from a database.

= image:transforms/icons/addsequence.svg[Add Sequence Icon, role="image-doc-icon"] Add Sequence


[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Add Sequence transform adds a sequence to the Hop stream. A sequence is an ever-changing integer value with a specific start and increment value.

You can either use a database sequence (if supported, e.g. Oracle, PostgreSQL) to determine the value of the sequence, or have it generated by Hop.

Hop-generated sequence values are unique when used in the same pipeline, and return to the same starting value each time you run the pipeline. Hop sequences are unique only when used in the same pipeline.
Also, they are not stored, so the values start back at the same value every time the pipeline is launched.
|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:cross.svg[Not Supported, 24]
!Flink! image:cross.svg[Not Supported, 24]
!Dataflow! image:cross.svg[Not Supported, 24]
!===
|===

== Options

[options="header"]
|===
|Option|Description
|Transform name|The name of this transform as it appears in the pipeline workspace.
This name must be unique within a single pipeline.
|Name of value|Name of the new sequence value that is added to the stream.
|Use DB to generate the sequence|Enable if you want the sequence to be driven by a database sequence, then set these parameters: Connection name, Schema name (optional), Sequence name.
|Connection name|The name of the connection on which the database sequence resides.
|Schema name (optional)|The table's schema name.
|Sequence name|The name of the database sequence.
|Use a pipeline counter to generate the sequence|Enable if you want the sequence to be generated by Hop, then set these parameters: Counter name (optional), Start at, Increment by, Maximum value.
|Counter name (optional)|If multiple transforms in a pipeline generate the same value name, this option enables you to specify the name of the counter to associate with.
Avoids forcing unique sequencing across multiple transforms.
|Start at|The value to begin the sequence with.
|Increment by|The amount by which the sequence increases or decreases.
|Maximum value|The value after which the sequence returns to the Start At value.
|===