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.
Connect with TQL
Before connecting with TQL, you will 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 (
Enter a SQL script
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:
- Connect to the database with the ThoughtSpot SQL Command Line (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.Tip: 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.