Connect with TQL and create a schema
Learn about TQL, ThoughtSpot’s SQL command line.
To perform administrative tasks directly in the database, you will use the ThoughtSpot SQL Command Line (TQL). TQL supports many, but not all, common SQL commands.
Before connecting with TQL, you need:
Access to your ThoughtSpot instance Linux shell from a client machine.
The administrator OS login.
To connect to TQL:
Log in to the Linux shell using SSH.
$ tql TQL>
Enter your SQL command, followed by a semicolon (
Having examined the structure of the data to be loaded and become familiar with the ThoughtSpot SQL Command Line (TQL), you are now ready to create the schema.
This method is a good way to get familiar with TQL and how to create database objects, but when creating a schema in a production system, you will most likely Write a SQL script to create the schema.
To create the schema directly in TQL:
If the database you will be using does not exist, create it now:
TQL> CREATE DATABASE my_database;
Connect to the database:
TQL> USE my_database;
If you wish to use a schema other than the default one, create it now:
TQL> CREATE SCHEMA my_schema;
CREATE TABLEcommand for each table you will create, using the information in Plan the schema.
Foreign key declaration within a
CREATE TABLEwill show the table created even if there are problems with the foreign key. Therefore, it is good practice to also issue a separate
ALTER TABLE ADD CONSTRAINT FOREIGN KEYcommand.