A newly created database does not have any tables. You can create one or more tables for a database in Senate. This article shows you how to create a table in the database.

Why do I need to create a table in Senate?

Creating a table for your data file allows you to later share a copy of this table in a Discovery Workspace within a project on Senate. Within a Discovery Workspace, authorized users can easily connect to the AWS Redshift database and query any tables that have been approved for access. 

Creating and sharing a table (rather than a data file only in a project) allows authorized users in a Discovery Workspace to take advantage of the fast query and computing performance of a Redshift database. 

In this article you will learn about

Prerequisites

You will have

Creating tables

From the Database Screen, click Create table.  


There are two parts to the Add Table screen. The top part is where you enter basic information about the table, while the bottom part is where you create your table columns.

On the Add Table screen:

  1. Give the table a name. The name must only have lowercase letters, digits and if you need a separator, use the underscore character.
  2. Type a description of the table.
  3. Scroll down to Add Columns.

In the Add Columns section:

  1. Type the name of the first column. Column names must only have lowercase letters, digits.
  2. Give it a description.
  3. Select a data type from the list.
  4. Click Add Column.

Important things to note when creating columns:

  • When specifying column names, do not use words reserved for databases, such as ‘date’.
  • When adding column descriptions, do use any special characters, including apostrophes or quotes.
  • Make sure the column data type matches the data type in the file you intend to load, otherwise there will be errors when loading data to the table. If in doubt, and if applicable, select the data type ‘string’ to prevent errors when loading data to table.

Add more columns as required.
Important! Don’t forget to click Add Column when adding the last column.

Click Create table when you have finished adding columns.

The new table is added to the database.

It doesn’t have any rows because we haven’t loaded any data yet.

At this stage, you could add more tables if you want to.

Tips for creating a table

  • Use CSV rather than TXT files
  • Use STRING rather than VARCHAR or CHAR as the data type. 
  • Check that columns are added in the correct order, as they appear in the CSV

Can I edit a table?

Once a table is created, the columns cannot be edited. If any changes need to be made to the column name or description, a new table needs to be created to load the data to, and the old table can be deleted if it is no longer required.

If an incorrect file has been loaded to the table, you can empty the table and proceed to load a new file to the table.

Emptying or deleting a table

To delete or empty a table:

Go to the Manage Data section, click Databases.

Click View or Edit Database.  

Select ‘Delete table’ or ‘Empty table’ and follow the prompts.

Next step: 

Loading data into tables

Did this answer your question?