DolphinDB VSCode Extension for SQLTools

SQLTools is a lightweight Visual Studio Code extension for database management. It supports a wide range of major databases, including MySQL, PostgreSQL, SQLite, and Oracle, through its plugin-driven architecture. It provides users with an efficient, all-in-one development experience, covering connection management, SQL query execution, intelligent code completion, query history, and more.

The DolphinDB VSCode Extension for SQLTools is a database driver package for the vscode-sqltools extension. It enables users to connect to and operate DolphinDB databases through the SQLTools framework within the Visual Studio Code environment.

To use it, simply search for and install "DolphinDB Driver for SQLTools" from the Visual Studio Code Extensions Marketplace.

Note: The current extension has been validated and tested with SQLTools v0.28.4.

Getting Started

Click the SQLTools Database Icon

Click the SQLTools database icon to navigate to the connection configuration interface.

Select DolphinDB in the Driver Field

In the Select your database driver field, select DolphinDB.

Configure Connection Information

Fill in the connection details. Fields marked with an asterisk (*) are required.

The configurations are as follows:

  • Connection Name*: A unique identifier for the connection. It is recommended to use the node alias, such as local8848 or dnode1.
  • IP*: The IP address of the target node, for example: localhost.
  • Port*: The port number used by the node, for example: 8848.
  • Username: The username for authentication. Defaults to admin.
  • Password: The password for authentication. The default password is 123456. You can modify it later using the changePwd function.
  • Auto Login: Whether to enable automatic login. Defaults to false. If a username and password are provided, you may choose to enable this option for automatic authentication on startup.
  • Show Records Default Limit: The default number of records displayed per page in query results.

Test and Save the Connection

After configuring the connection, click the TEST CONNECTION button to verify if the connection is successful.

If the test is successful, click SAVE CONNECTION to save the connection information.

Connect and Start Scripting

After saving, the system will display basic connection information. Please ensure that the details are correct.

Click CONNECT NOW to establish the connection and create a new SQL file for writing scripts.

UI Description

SQL Tools Sidebar

The SQL Tools sidebar displays different connection information. Each connection includes three subsections:

  • Databases: Contains distributed database and table information, which includes: database name, table name, column name, and column type.
  • In-memory Tables: Contains in-memory table information, which includes: table name, column name, and column type.
  • Variables: Contains information about other variables, which includes: variable name and variable type (e.g., matrix, scalar, set, etc.).

Operations

For table objects, click the magnifying glass icon on the right to view table data.

Click the + button to generate an insert statement.

In the script execution section, users can write scripts and then click Run on active connection to execute the script.

The results section on the right will display:

  • The script execution results.
  • Table records queried using the Show Table Records command.
  • Table schema using the Describe Tabe command.
    Note:

    When executing a script with multiple statements in DolphinDB, only the result of the last statement is returned.

  • Function Buttons:
    • CONSOLE: SQL terminal, outputs execution information. Typically, execution information includes details such as the dimensions, type, and data format of the returned object.
    • RE-RUN QUERY: Re-executes the statement.
    • EXPORT: Exports execution results as a CSV or JSON file.
    • OPEN: Views execution results as a CSV or JSON file.

Query History Section

The QUERY HISTORY on the left saves the query history records, allowing users to review or re-execute previous queries.