---json
{
"page_id": "cq4g0pgtofohvxo7azrwb"
}
---
====== Data Operation - Select (Selection) ======
===== About =====
''select'' is a [[:docs:flow:supplier|supplier]] [[docs:op:op|data operation]] that selects [[docs:resource:resource|data Resources]].
This is not the [[docs:resource:sql_select|sql select statement]]. The [[docs:resource:sql_select|sql select statement]] selects [[docs:resource:record|records]] while the ''select'' operation selects [[docs:resource:resource|Data Resources]].
See the following ''learning guide'' page, to known more: [[howto:getting_started:4_select_data_resources]]
===== Arguments =====
The ''select'' operations has the following arguments.
^ Argument ^ Default ^ Description ^
| [[docs:flow:data_selector|data-selector]] | - | Select [[docs:resource:resource|data resources]] by [[:docs:common:globbing|glob pattern]] |
| [[docs:flow:data_selector|data-selectors]] | - | A list of [[docs:flow:data_selector|data-selectors]] |
| [[docs:op:with-dependencies|with-dependencies]] | false | If set to true, the [[docs:resource:dependency|dependencies]] will be added |
| ''data-def'' | Optional | The [[docs:resource:attribute|data attributes]] defined in a [[:docs:resource:data-definition|data definition]] format |
| ''logical-name'' | Optional | A [[:docs:conf:template|template logical name]] |
| ''media-type'' | Optional, detected by default | The [[docs:resource:media-type|media type]] of the selected resources |
| ''order'' | Natural | The order in which the data resources are returned. Possible value: `natural`, `drop`, `create` (Note that the ''order'' is by connection.) |
| ''processing-type'' | ''batch'' | The [[:docs:flow:processing-type|processing type]] (''batch'' or ''stream'') |
| ''strict-selection'' | false | If set to true, the ''select'' operation will throw an error if \\ * the selection does not return any data resource \\ * or any view is invalid |
When the processing type is ''stream'', the [[:docs:flow:stream_pipeline#attributes|stream attributes]] can be used
===== Usage =====
Flow
Tabul Data Command
In a [[docs:flow:pipeline|pipeline pipeline]], this is a first operation (known as the [[docs:flow:supplier|supplier operation]]) because it supplies [[docs:resource:resource|data resources]] to the others operations in the pipeline.
Example:
* Simple selection:
pipeline:
- name: 'Select data resources'
operation: select
args:
data-selector: pattern@connection
with-dependency: (yes|no)
strict-selection: yes
In a [[docs:tabul:data:start|tabul data command]], you set :
* the [[docs:flow:data_selector|data selector]] as argument
* and the [[docs:op:with-dependencies|with-dependencies]] as [[docs:tabul:flag|flag]]
* and the ''not-strict'' as [[docs:tabul:flag|flag]]
Example:
tabul data command [--not-strict] [--with-dependency] dataSelector
You can verify the selected data resources with the [[:docs:tabul:data:list|tabul data list command]].
===== Note on Empty Selection =====
If no ''data resource'' matched the [[docs:flow:data_selector|data selector]], this is not considered an error.
This is already the case for all sql statement (ie an update that does not match a row does not return an error)
If you want to throw an error, you should set the ''strict-selection'' option to true.