Query data code description
Learn about the limits and rules for querying data by using code in Dataphin.
Limits
Dataphin returns a maximum of 10,000 query result records. You can append limit number of returns to a query statement to customize the number of returned records. For example, select * from ht5_out limit 20; retrieves 20 records.
Notes
-
If a data query task runs for more than 2 hours, Dataphin automatically terminates the task to free up resources and keep other tasks running smoothly.
-
Querying a logical aggregate table with the
select *syntax can consume significant resources. We recommend that you avoid usingselect *in ad hoc queries on logical aggregate tables. For more information, see set the engine for ad hoc queries.
Code description for querying data
-
Query logical table data.
SELECT * FROM sectionEnglishName.logicalTableName WHERE ds='${bizdate}';
Where:
-
Module English Name: The Module English Name of the module to which the logical table belongs.
You can find the module English name on the data section page.
NoteWhen querying data in a development environment, append _DEV to the Sectionenglishname, resulting in Sectionenglishname_dev.
-
logicalTableName: The name of the logical table to be queried.
-
ds='${bizdate}': The partition date for the query. The built-in Dataphin global variable
${bizdate}defaults to the format yyyyMMdd and represents the day before the current date. You can also specify an exact date, such asds='20210223'.
If the permission to use the select * syntax on a logical aggregate table is revoked, running a select * statement returns an error. You must specify individual fields instead.
-
Query physical table data.
SELECT * FROM projectEnglishName.physicalTableName WHERE ds='${bizdate}';Where:
-
Projectenglishname: The English name of the project that contains the physical table.
You can find the project English name on the project information settings page.

-
Physicaltablename: The name of the physical table to be queried.
-
ds='${bizdate}': The partition date for the query. The built-in Dataphin global variable
${bizdate}defaults to the format yyyyMMdd and represents the day before the current date. You can also specify an exact date, such asds='20210223'.
-