Extensions Quick Start

This quick start is designed to walk you through the process of creating and using a TeamSQL extension. We will work with the Context Menu extension, which is activated whenever the user right-clicks on a results set after successfully executing a SQL query.

You'll need a TeamSQL account, as well as a local installation of TeamSQL. You can download the latest version of TeamSQL, and after you launch it for the first time, you can sign up for a free account.

Create Your Extension

To create an extension, you'll need to use the TeamSQL CLI. You can install it by running the following command:

> npm install -g @teamsqlio/teamsql-cli

Before you can use the TeamSQL CLI, you'll need to log in with your TeamSQL credentials.

> teamsql-cli login

To get started with our extension, let's select a template. Once we provide our selection, we'll get a cloned version of the template.

> teamsql-cli create

Select Context Menu, and press Enter to begin cloning the repository that contains the files you need.

Before proceeding further, navigate into your newly-cloned folder and install the required npm packages:

> cd extension-context-menu-template
> npm install

Since this project is written in TypeScript, you must build it after you install npm packages. If you don't already have TypeScript installed in your computer, you can install it by running:

> npm install -g typescript

Now, build the extension project with TypeScript:

> tsc -p .

Install Your Extension

At this point, the template project is ready to test. You will need to install this sample extension to your local TeamSQL installation:

> teamsql-cli submit --install

This installs the extension and makes it available for use with your local instance of TeamSQL.

Use Your Extension

To see your extension in action, you'll need to:

  • Launch TeamSQL
  • Log in to the TeamSQL app with the credentials you used to log in to the TeamSQL CLI
  • Create a new database connection (if you don't have one already)
  • Connect to your database, and open up a new query window
  • Write a SQL query, such as SELECT 'Can' as Name, 'TeamSQL' as Company, '[email protected]' as Email
  • Execute your query.
  • When TeamSQL returns your results, right click on the results set. You'll see your extension as follows:

results matching ""

    No results matching ""