This Howto will show you how to create a SQL table with a SQL DDL file that contains a CREATE SQL statement with the Tabul table create command.
The next steps will be using the postgres howto connection.
tabul service start postgres
1 service was started
Name Type
-------- ------
postgres docker
tabul connection ping postgres
The connection (postgres) has been pinged successfully
We will execute the below SQL Script that is located in the howto connection.
-- Create the foo table statement
create table foo (
bar integer
)
With the tabul data create command, if you use a runtime selector as first argument, the selected runtime are executed.
To execute the previous SQL script, the below the command should be executed:
tabul data create '(create_foo.sql@howto)@postgres'
# The quotes are mandatory because parenthesis have a meaning in Bash (ie they start a subshell)
where:
List of runtime executed
runtime_data_uri exit_code count latency data_uri error_message
------------------------------- --------- ----- ------- ------------------------------------------------------------- -------------
(create_foo.sql@howto)@postgres 0 1 0.23s execute/20251110-204521-829-pipe-anonymous/create_foo.log@tmp
Check the metadata with the tabul data describe command
tabul data describe foo@postgres
Structure of the resource foo@postgres
position name type precision scale primary_key nullable autoincrement comment
-------- ---- ------- --------- ----- ----------- -------- ------------- -------
1 bar integer 10 0 x
You can also create a table and its dependencies (foreign tables) at once with the tabul data create command.