Synapse Tables are used to organize web-accessible, sharable, and queryable data. Tables may be queried and edited with the Synapse web client, as well as with the Synapse programmatic clients. This article guides you through the process of creating a Table. For information about searching a Table, see Search Tables and Views.
To learn more about creating Tables and creating queries using one of the Synapse programmatic clients, see:
Tables in Python Docs
Tables in R Docs
What is a schema?
A schema is the structure of your dataset. In a Table, a schema defines the structure by specifying the column names. A schema may also define the values or types of data allowed in each column.
You can define Table columns to contain common data types like text, numbers, and dates, or you can define columns to include references to other Synapse objects, like Files and Folders. Synapse currently supports several kinds of text columns (STRING, LARGE TEXT), dates (as TIMESTAMP), a variety of numeric columns (INTEGER, DOUBLE), and various Synapse identifiers (ENTITYID, USER). For a complete list of column types and definitions, please see the REST docs on columnTypes.
Creating a New Table from a File
Tables require structured data contained in a .csv
or .tsv
file. If your structured data is saved in an Excel format such as .xls
or .xlsx
, you must “save-as” to convert the file to a .csv
before you proceed in Synapse. Navigate to the Tables tab in your Project and select Upload a Table. If you provide a .csv
or .tsv
file, Synapse will infer your Table schema based on the column headers. You may further customize the schema by selecting Schema Options.
For very large files, it may take time for the Table to be built and indexed completely before it can be viewed. You may navigate away from the Table once you have clicked Create, and you will not lose any data.
Create an Empty Table
You have the option to create an empty Table by clicking on the Tables Tools menu and Add Table. To build a new Table, you must specify the Table structure, column by column. Select Add Column to set the Column Name, Column Type, Size, Default Value, and Restrict Values.
If you create an empty Table, you will need to click on Table Tools and Upload Data to Table to upload data from a .csv
or .tsv
file. The first line of your file must match the Table structure specified.
Alternatively, you may add rows and Table data manually. To add, delete or modify existing rows, click on the Edit Query Results icon to Edit Rows.
Click the + sign to add rows. To delete rows, check the boxes of the rows to delete and click the Trash Can icon.
Warning: Column names must be 256 characters or less. There are three reserved words that cannot be used: ROW_ID, ROW_VERSION, ROW_ETAG (case insensitive).
Modify Table Schema
Click Table Tools, Show Table Schema and Edit Schema to modify the existing Table structure. From Edit Schema, you can delete columns, add new columns, modify existing columns, define default column values, restrict column values, and add facet values.
Search a Table
You can search for data within a Table in two ways. The default search is a simple search menu to the left of your Table. Use the facets to filter your dataset and narrow down your search. Table data can also be retrieved by using a SQL-like query language either through the web portal or through the analytical clients. See the Search Tables and Views page for more information.
Delete a Table
To delete the entire Table, click on the Tools menu and then select Delete Table.
Add Files to a Table
Synapse Tables support a special column type called File that contains a file handle, an identifier of a File stored in Synapse. In the example below, this feature is used to add image files to a Table containing histology data.
First, navigate to a Table and add a new column for Files. To add columns, Click Table Tools, Show Table Schema and Edit Schema. From the pop-up window, click the Add Column button and set the Column Type as File. Click Save to exit from the Edit Columns window.
Next, click the Edit Query Results button (pencil icon). In the column you just created, click the upload icon to add a File from your local computer.
Versioning a Table
You can create a version history for any Table in Synapse. Versioning helps you keep a record of what changes you made to the Table and when you made them. For more information on versioning a Table, see the Versioning Tables and Views page.
See Also
Annotations and Queries, Downloading Data, Files and Versioning