Delete or change a table in TQL

You can delete a data source in the web browser or using ThoughtSpot SQL Command Line (TQL).

When you enter a TQL statement, the system warns you of possible dependency consequences with a prompt asking if you’d like to proceed. This should make you feel safe issuing TQL commands, even commands like dropping a table.

If you do not run the script using the flag, it will fail if any of its commands might cause problems with dependent objects.

TQL actions with possible dependency consequences include:

  • Change, add, or remove a primary key.

    • When changing or adding a primary key, if the key in question is not unique in the data it may cause deletion of rows, because of upserts occurring when duplicate primary keys are found.

    • When changing or removing a primary key, incoming foreign key relationships will be broken.

  • Change a column datatype.

  • Add a relationship or foreign key.

  • Drop a relationship or foreign key constraint.

  • Change or add a sharding key.

  • Drop a table, schema, or database.

When issuing one of the previous commands, you will see a warning message similar to this:

TQL> ALTER TABLE table1
     DROP CONSTRAINT PRIMARY KEY;

WARNING: This operation will break the Foreign Key relationship “products”
with table “sales”, which will break 34 user-visible visualizations and
2 Worksheets. We recommend taking a snapshot before performing this operation.
Do you wish to proceed? (yes/no).