====== Data Resource - Target Data URI ======
===== About =====
A ''target uri'' is a ''uri'' that defines one or more [[docs:flow:target|target resources]] for [[docs:op:transfer|data transfer operations]].
===== Example =====
==== Reusing the name of the source in the target ====
The below target data uri
new_$name@sqlite
will define the ''target resource''
* located in the sqlite connection
* and a name that is composed of
* the prefix ''new_''
* and the [[docs:resource:name|name of the data source]] (''$name'')
Example: if the source table name is ''time'', the target table name would be ''new_time''
==== Using a part of source name in the target ====
With a [[docs:common:globbing|glob pattern]], you can reference parts of the source.
Example with the below [[data_selector|data selector]]
D?*@sqlite
and the below target data uri
$2@sqlite
* if the source table name were ''D_TIME'', ''D_CUSTOMERS'',
* the target table names would be ''TIME'', ''CUSTOMERS''
==== File system ====
In a shell such as powsershell, the ''$'' character should be quoted. (That's why [[docs:common:bash|we recommand bash]])
tabli data copy '*/bootstrap.min.css@cd' '/boot/bootstrap.$1.min.css@cd'
===== Syntax =====
pattern[@connection]
where:
* ''connection'' is the [[docs:connection:name|name of a connection]]
* ''pattern'' is an expression that define the name of the target. This pattern can include the captured characters from the [[data_selector|data selector]] glob expression.
==== Glob Backreference ====
In the pattern, you can reference a [[docs:common:globbing|globbing matched wildcard]] from a [[data_selector|data source selector]] using the ''$x'' syntax where x indicates the index of a glob pattern. ie
* ''$0'' defines the whole expression (ie the whole path)
* ''$1'' defines the first matched wildcard
* ''$2'' defines the second matched wildcard
* and so on until ''$9''.
You can see the value of the back reference with the [[docs:tabli:data:list|tabli data list command]].
If you want to know the value of ''$1'', just ask for the attribute ''1''
Example with [[docs:system:tpcds|tpcds]] where we want to capture the name of the web table but without the prefix.
tabli data list -a name -a 1 web_*@tpcds
name 1
----------- -------
web_page page
web_returns returns
web_sales sales
web_site site
==== Attribute Reference ====
In the pattern, you can reference a [[docs:resource:attribute|resource attribute]] using the ''$x'' or ''${x}'' syntax where x indicates the name of the attribute.
Example:
* ''$logicalName'' defines the [[docs:resource:logicalname|logical name]] of the resource
You can see all available attributes with the [[docs:tabli:data:info|data info command]].
tabli data info web_page@tpcds
Information about the data resource (web_page@tpcds)
attribute value
--------------- ------------------------------------------------------------------------------------------------
AbsolutePath web_page
Connection tpcds
DataUri web_page@tpcds
LogicalName web_page
Md5 2d3f08a0ad007e5236ed694250e89721
Name web_page
Parent /
Path web_page
Sha384 0d3fcd0bd2dc1aa6c14a6ce4a4c8acff06a6194a4f56f4730bbb371aaf490da1fe318f9f11ba44157ffd53d501e2f551
Sha384Integrity sha384-DT/NC9LcGqbBSmzkpMis/wamGUpPVvRzC7s3Gq9JDaH+MY+fEbpEFX/9U9UB4vVR
SubType table
Type table
==== Column Value Reference ====
If your step is running on [[docs:flow:granularity|record level]], you can also add a column value using the ''$x'' or ''${x}'' syntax where x indicate the [[docs:resource:column|column name]].