Data Resource - Runtime Data Resource
About
A runtime data resource is a special type of data resource that represents:
- a data resource known as the executable resource
- that should be executed against a connection
They are called runtime data resources because these data resources are created at and by the execution.
Example
(create.sql@cd)@sqlite
- A script.sh Shell script located in the current directory that should be executed at the temporary runtime directory
(script.sh@cd)@tmp
Type
| Execution Locality | Description | List |
|---|---|---|
| Remote request | Request/Response to a service | SQL Request - database request HTTP request - web server request |
| Local | Operating System Command | Script command - Textual computer language file Binary command - Language Interpreter, Compiled Machine code instructions |
Data Uri
Default Execution
A executable is represented with the following data uri
(executablePath@executableConnection)@executionConnection
where:
- executablePath@executableConnection is the data uri of the executable resource. ie:
- the resource containing the code
- or an executable binary
- executionConnection is the connection where the execution resource is executed.
Nested Execution
We even support deep nested execution resource when the execution of an executable returns a another executable.
((executableResourcePath@executionResourceConnection)@executionResourceConnection)@executionConnection
For instance:
- Execution of a SQL file located in a online zip archive against MySQL: How to install the World MySQL Sample Schema
((archive/world-sql--archive-entry.yml@howto)@tmp)@mysql
- Execution of SQL scripts against @postgres
- where the scripts are retrieved from a select statement where:
- the select is stored in the select_statement.sql sql file located in the current directory
- executed against @sqlite
((select_statement.sql@cd)@sqlite)@postgres
Runtime Data Selectors
Runtime resources can be selected with a executable selector.
Execution
runtime resources are automatically executed at access/runtime.
For instance:
- a sql select would be automatically executed and would return a result set.
- a script would be automatically executed and return its standard output (as default)
Every operation will execute them when accessing them
- …
ie:
- If you print it 2 times, you will execute it 2 times.
- If you print and copy it, you will execute it 2 times.
Example of execution:
- with the print command for a SQL Query
tabul data print '(select.sql@cd)@sqlite'
# The quotes are mandatory in bash because parenthesis are a bash token (ie subshell)
- with the copy command for a series of SQL DML statement where the execution result is stored in the result.log file in the temporary directory.
tabul data copy '(create_dml.sql@cd)@sqlite' result.log@tmp
# The quotes are mandatory in bash because parenthesis are a bash token (ie subshell)
Execute Operation
With the execute operation, you can perform execution in batch and get back the exit status.
Example: To execute:
- located in the current directory (cd)
- against the sqlite howto connection
you would execute this tabul data execute command
tabul data execute '(query*.sql@cd)@sqlite'
# The quotes are mandatory in bash because parenthesis are a bash token (ie subshell)
Attributes
Logical Name
The default logical name is the logical name of the execution resource.
Executable
The executable is the file found in the first part of the runtime data uri.
For instance, in this runtime data uri
(query.sql@cd)@sqlite
the executable is: query.sql@cd
query.sql@cd defines:
- the query.sql sql file
- in the current directory (cd)
as executable
FAQ
Does a runtime resource exists
| Runtime created from | Exists |
|---|---|
| A data uri | the executable exists |
| Dynamically with a pipeline operation | true |