This Howto will show you how to create a SQL View with a SQL file that contains a CREATE SQL statement with the Tabul table create command.
You should have Tabulify installed on your computer: Learning Tabulify - Step 1 - Installation
We will execute the below SQL Script that is located in the howto connection.
create view foo as
select "bar"
With the tabul data create command, if you use a runtime selector as first argument, the selected script are executed.
To execute the previous SQL script, the below the command should be executed:
tabul data create '(create_view_foo.sql@howto)@sqlite'
# The quotes are only mandatory in bash because parenthesis are a bash token (ie subshell)
where:
List of runtime executed
runtime_data_uri exit_code count latency data_uri error_message
---------------------------------- --------- ----- ------- ------------------------------------------------------------------ -------------
(create_view_foo.sql@howto)@sqlite 0 1 0.27s execute/20251110-204922-162-pipe-anonymous/create_view_foo.log@tmp
Check the metadata with the tabul data describe command
tabul data describe foo@sqlite
Structure of the resource foo@sqlite
position name type precision scale primary_key nullable autoincrement comment
-------- ----- ---- --------- ----- ----------- -------- ------------- -------
1 "bar" text 0 0 x