DataWorks support importing local data by using the following two methods:
Upload the data in locally stored text files to the table in the workspace.
Use the data integration module to import business data from various data sources to the workspace.
Use Chrome 48 or later versions
The limits of uploading local text files are as follows:
File type: Only .txt and .csv formats are supported.
File size: No more than 10 MB.
Operation object: If partition tables are imported, the partitions must not contain any Chinese characters.
This article describes how to upload local files to DataWorks by taking banking.txt as an example.
Click Import and select Import local data.
Select a local data file. Configure import details and click Next.
If the table for the data to import already exists, enter at least two letters to search for the table name.
If the table for the data to import does not exist, click Create a Table. Enter the statements of table creation, and click OK.
The statements of table creation are as follows:
CREATE TABLE IF NOT EXISTS bank_data
age BIGINT COMMENT 'Age',
job STRING COMMENT 'Job type',
marital STRING COMMENT 'Marital status',
education STRING COMMENT 'Educational level',
default STRING COMMENT 'Ownership of credit cards',
housing STRING COMMENT 'Housing loan',
loan STRING COMMENT 'Loan',
contact STRING COMMENT 'Contact information',
month STRING COMMENT 'Month',
day_of_week STRING COMMENT 'Day of the week',
duration STRING COMMENT 'Duration',
campaign BIGINT COMMENT 'Number of contacts made for this campaign',
pdays DOUBLE COMMENT 'How long ago was the last contact',
previous DOUBLE COMMENT 'Number of contacts with the customer previously',
poutcome STRING COMMENT 'Results of previous marketing campaigns',
emp_var_rate DOUBLE COMMENT 'Employment change rate',
cons_price_idx DOUBLE COMMENT 'Consumer price index',
cons_conf_idx DOUBLE COMMENT 'Consumer confidence index',
euribor3m DOUBLE COMMENT 'Euro deposit rate',
nr_employed DOUBLE COMMENT 'Number of employees',
y BIGINT COMMENT 'Ownership of fixed term deposits'
) PARTITIONED BY(pt STRING) ;
You can only edit and run one statement of table creation when creating the table. Statements are separated by “;” if you are editing more than one statement. But only the first statement can be run.
The MaxCompute SQL syntax is required in the statement of table creation. This syntax is slightly different from the standard SQL. For more SQL syntaxes, see DDL statements.
After the table is created, a New table is created message appears in the upper right corner of the page.
After selecting the table name for the data to import, select the field matching method (“By location” is selected in this example). After “By location” is selected, a Click Test to check whether the partition exists message appears. After the test is complete, click Import.
The test function is only used to check whether the partition exists. If it exists, append the partition. If it does not exist, create a partition without entering any Chinese characters.
After the file is imported, the system tells you whether your data import is successful or not.