SQL Console

Updated at:
Copy as MD

The SQL Console in Data Management (DMS) lets you execute various SQL statements and provides a visual interface to manage data in your database, making it ideal for tasks like data querying and development.

Prerequisites

You must have query permissions on the target database or table. To apply for permissions, see Apply for asset permissions by submitting a ticket.

SQL Console interface

Table 1. SQL Console interface components

Area

Section

Description

Left-side resource tree

Visual operation section

Manage your database visually.

  • Table

    You can view all tables in the current database, including their columns, column types, and indexes. You can also right-click a table to edit its structure, manage it, export or import data, and perform batch operations.

  • Programmable Object

    Create, view, execute, and manage Programmable Objects, such as views, stored procedures, functions, triggers, and events.

    Note

    The console displays up to 1,000 entries.

  • key-value pair information

    Note

    DMS displays this information for NoSQL databases.

Top toolbar

Extended features section

The following features are available:

  • tubiao (Apply for data owner/Change control): Click this icon to apply to be a data owner or to configure DDL, DML, and SELECT change permissions for the target database.

  • Table Details (Table List): Click this icon to switch to the Table List page, and click the Query icon to return to the Query page.

  • 数据分析图标 (Data Analysis): Click this icon to create a data analysis ticket. For more information, see One-click data warehousing.

    Note

    This icon is displayed only for ApsaraDB RDS for MySQL databases.

  • shujuku (Database Analysis): Provides database autonomy services such as one-click diagnostics, real-time performance, instance sessions, and space analysis through Database Autonomy Service (DAS). You are redirected to the DAS console. For more information, see Real-time Performance and Instance Session.

  • 同步元数据 (Sync Metadata): After you click this button, DMS collects the latest metadata from the database, such as tables, columns, indexes, and Programmable Objects. This enables hierarchical permission control for tables, columns, and Programmable Objects. For more information, see metadata.

  • 导出 (Export): Use the export feature to export a database, its table structure, or table creation statements. You can also access the Manage Table Structure Versions page.

  • 5控制台-操作审计 (operation audit): The operation audit feature saves all data query and change records. You can query details like the operation, the user, and the time of the operation. For more information, see operation audit.

    The risk audit feature collects and assesses various risks associated with database usage. For more information, see Risk audit report.

  • 分享功能图标 (Share): Use this feature to share the console and commands for this database with relevant personnel. For more information, see Share an SQL Console.

  • 超级SQL (Super SQL Mode): After you enable Super SQL Mode, administrators and DBAs can execute SQL statements in the SQL Console without being restricted by security rules. For more information, see Super SQL Mode.

SQL editor pane

Command execution section

Enter an SQL statement and click Execute to perform operations on the database. Other features are also available, such as Format, execution plan, and Settings.

  • Execute: Click Execute to run the SQL statement you entered.

  • Format: Click Format to optimize the format of your SQL statement.

    For example, if you enter SELECT * FROM `test_table`; and click Format, the SQL statement is formatted as follows:

    SELECT
      *
    FROM
      `test_table`;
  • Execution plan: View the execution plan for the SQL statement you entered.

Note

You can click the 增加页签 icon in the upper-right corner of the page to open multiple SQL Console windows.

Bottom log pane

Execution results section

After you execute an SQL statement, you can view the results. You can also view row details, add rows, delete rows, and submit changes.

Note

Click Execution History to view the SQL execution history, which includes details such as the start time, database, and SQL, and can be exported.

Default behavior and limits

  • If a table contains sensitive or confidential columns and you do not have the required permissions, the query results show ****** for these columns. For more information, see Sensitive data management.

  • Note the following about the number of rows returned by a database query:

    • For a database in Flexible Management mode or Stable Change mode, the default maximum number of rows returned is 3,000.

    • For a database in Security Collaboration mode, the default number of rows returned is 200, and the system-defined maximum is 3,000. An administrator can modify the number of rows returned in the Basic Configuration Item section by navigating to Security and Specifications > Security Rules > SQL Console.

      Note

      If you need to query more data without being restricted by security rules, you can export the data to your local computer for analysis. If a table contains sensitive columns, you can apply for permissions to export their data before you export the data. For more information about how to apply for permissions and export data, see Apply for permissions by using a ticket and Export database data.

  • The maximum size for a full table scan is 10 GB. An administrator can modify this value by navigating to Security and Specifications > Security Rules.

  • The default timeout for executing a single SQL statement is 60 seconds. An administrator can modify this value by navigating to Instances > More > Edit > Advanced Information.

Procedure

  1. Log in to DMS 5.0.

  2. In the top navigation bar, choose SQL Console > SQL Console.

    Note

    If you are using the console in Simple mode, click the 2023-01-28_15-57-17 icon in the upper-left corner and choose All functions > SQL Console > SQL Console.

  3. In the Select Database dialog box, search for and select a database, and then click Confirm.

  4. In the SQL Console area, enter an SQL statement, and then click Execute.

FAQ

Q: I use Data Management Service (DMS) to log in to a MongoDB instance. When I execute an SQL statement, I receive the error 'Incomplete command. Please check.'

A: Some MongoDB commands require the new parser. Click Open Parser to switch to the new parser. For a complete list of commands supported by the new parser, see Supported MongoDB commands.

Related documents

After you understand the features of the SQL Console interface, you can create tables, query data, or modify data in the SQL Console. For more information, see Get started with the SQL Console.