CoginitiScript is a set of blocks, where each block represent source code and language. Similar to Paragraphs in the notebook. Each block is defined using the following syntax:
#+src language name([arg=val...])[: returntype] #+begin ... source code here #+end
Source code outside given blocks are treated as default SQL block. For example, following source code:
SELECT 1; SELECT 2; #+src sql foo() #+begin SELECT 3; #+end SELECT * FROM {{ foo() }};
Will be represented as 3 blocks:
- SQLBlock with “SELECT 1” and “SELECT 2” as a source code
- SQLBlock “foo” with correspondent source code
- SQLBlock with “SELECT {{ foo() }}” as source code
Alternatively, the same script could be written as:
#+src sql #+begin SELECT 1; SELECT 2; #+end #+src sql foo() #+begin SELECT 3; #+end #+src sql #+begin SELECT * FROM {{ foo() }}; #+end
User will be able to configure what type of default block is used.
This reveals the interesting characteristic of CoginitiScript:
- any SQL file is a valid CoginitiScript file - any Python file is a valid CoginitiScript file - any [language we support] file is a valid CoginitiScript file
Please note that syntax of block invocation has changed from ${block()} to {{ block() }} in 22.5.