NineData DSQL
NineData DSQL supports querying data from multiple different types of data sources and aggregating to generate global query results. This article explains how to use NineData DSQL.
Background Information
With the explosive growth of enterprise data, the need for data interaction across departments, applications, and platforms has become increasingly frequent. Traditional data query methods are no longer sufficient to meet these demands. Additionally, there are differences in data formats, storage methods, and query languages between different database systems, making cross-database queries difficult. Therefore, NineData DSQL was created.
What is NineData DSQL?
NineData DSQL is a way to perform cross-database queries on multiple heterogeneous or homogeneous database systems. You can access multiple databases in a single query, retrieve useful information scattered across these databases, and aggregate this information into a single query result. This allows for easy data querying across multiple databases, multiple data sources, and even across multiple heterogeneous data sources.
NineData DSQL has the following features:
- Connect to multiple database systems: Supports connecting to multiple database systems and ensuring compatibility between these systems. These database systems can come from different vendors or platforms, and there may be differences in data formats, storage methods, query languages, etc.
- Result integration and output: Integrates query results from both homogeneous and heterogeneous database systems and standardizes the output format, making it easy for you to obtain the desired information. You don't need to know where the data is stored; you can obtain the results you need with a single query.
- Data privacy and security protection: Supports anonymization of sensitive data and control of access permissions to protect data privacy and security, preventing data leaks and unauthorized access.
- Scalability and flexibility: It is highly scalable, supporting the dynamic addition and removal of data sources. It also supports various types of data sources, including relational databases, non-relational databases, data warehouses, etc.
- Graphical interface support: Provides an intuitive graphical interface for visual querying and management, improving your work efficiency.
Query Syntax
In DSQL, whether you are performing a join query or a single-table query, you need to use a three-part syntax to specify the source data, i.e., <DBLINK name>.<database|Schema name>.<table name>
.
Example 1: Cross-heterogeneous source query, querying data from DBLINK1 (MySQL) and DBLINK2 (Oracle).
SELECT *
FROM DBLINK1.database_name.table_name a,
DBLINK2.schema_name.table_name b
WHERE a.id=b.id;
Example 2: Single-table query, querying data from DBLINK1.
SELECT *
FROM DBLINK1.database.table_name
WHERE id=1;
If your database or table name starts with a number or uses a reserved field, you need to enclose the name in double quotes ("") to avoid query failure.
For example: SELECT * FROM dblink_mysql_3451."9zdbtest3".sbtest1;
Use Cases
- Enterprise data integration: Enterprises often need to integrate data from multiple departments or systems to provide a more comprehensive view. With DSQL, enterprises can access multiple databases in a single query, retrieve useful information scattered across these databases, and integrate it for easier data analysis and decision-making.
- Data mining and analysis: Data mining and analysis require a large amount of data support. With DSQL, you can retrieve the needed data from multiple databases and then conduct in-depth research and analysis using mining and analysis tools.
- Metadata management: Metadata is data about data and is crucial for data management and understanding. With DSQL, you can retrieve metadata from multiple databases to better understand the distribution, content, and relationships of the data.
- Data warehousing: Data warehousing involves storing and managing a large amount of data. With DSQL, you can query and retrieve the needed data from data warehouses and then perform further analysis and processing.
- Shopping websites: Shopping websites typically need to query across multiple databases to retrieve user shopping cart information, order information, account information, etc. With DSQL, you can access multiple databases in a single query to retrieve the required information and improve query efficiency.
Prerequisites
- You have created or joined an organization, and this organization has subscribed to either or . Please ensure that your annual or monthly subscription is still active. For more information, please refer to Manage Organizations.
- Your current account has switched to the target organization. For more information, please refer to Switching to an Organization.
- The data sources you are using are MySQL, Oracle, and OceanBase Oracle.
- You have entered the data sources you need for DSQL into the NineData console. For more information, see Creating Data Sources.
Steps
Log in to the NineData console.
Click on > in the left navigation bar.
In the window, you can perform cross-database queries on multiple data sources. As shown in the image below:
tipIf sensitive columns have been added to the target data source, you will not be able to view the complete contents of the sensitive columns. If you need to view them, please apply for sensitive column permissions first.
The left side of the window displays all the data sources with DSQL functionality enabled in your organization that you have permission to view. This allows you to quickly query the DBLINK nameEvery data source entered into NineData is automatically enabled with DSQL functionality and is assigned a default DBLINK name for cross-database querying. The default DBLINK naming rule is
DBLINK_<data source type>_<number>
. You can manually change the DBLINK name., database name, Schema name, and table name.For more instructions on using DSQL, please see DSQL Interface Instructions.
DSQL Interface Instructions
Number | Function | Description |
---|---|---|
1 | DSQL Tab | Represents the currently open DSQL tabs. You can switch between multiple DSQL tabs by clicking on the tab, and you can close a DSQL tab by clicking the X on the right of the tab (the first DSQL tab cannot be closed). The right-click menu supports the following actions:
|
2 | New DSQL Tab | Opens a new DSQL tab. |
3 | Function Buttons |
|
4 | DBLink Search|Filter|Favorite | To quickly locate the target DBLink (data source) through the following methods:
|
5 | DBLink List | Display all data sources (DBLinks) that you have permission to view in the current organization.
|
6 | DSQL Editor | Supports the following features:
|
7 | Execution Information, Result Set | Display the execution information and result set of DSQL.
|
Appendix: Closing DSQL
The data sources you enter in the NineData console have DSQL functionality enabled by default. If you no longer need this functionality, you can manually disable it.
- Log in to the NineData console.
- Click on >.
- Find the data source in the data source list for which you want to disable DSQL functionality and click on the data source's ID.
- On the page, click on to expand more information.
- Find the option and click the slider to the right to turn it off.
Once turned off, the data source will no longer appear in the list on the left side of the window.