Navigate to: Resources > Data Sources
Select the Alibaba MaxCompute Icon:
Name (required)
Description (optional)
Endpoint (required): URL corresponding to the region MaxCompute is hosted
The corresponding values can be found here: Configure Endpoints in in Alibaba Cloud
Region (required): Specific region for your MaxCompute project
Example: us-west-1
Project (required): Name of your MaxCompute project
Credential Type: See Data Source Security
AccessKey ID (required - can be entered later): See Configure Authentication
AccessKey Secret (required - can be entered later): See Configure Authentication
%pythonfrom odps.df import DataFrameimport pandas as pd# Create a MaxCompute (ODPS) entrance objecto = z.getDatasource("zepl_docs_alibaba_maxcompute")# Get table referencetable = o.get_table('sale_detail')# Create ODPS DataFrameodps_df = table.to_df()# Convert to Pandas DataFramepandas_df = odps_df.to_pandas()z.show(pandas_df)
Use z.getDatasource()
to return MaxCompute entrance object: odps.core.ODPS
%datasource.zepl_docs_alibaba_maxcompute# Uncomment if full table scans are required for this query# SET odps.sql.allow.fullscan=true;SELECT * FROM sale_detail;
If you are experiencing this error ODPS-0130071
, please reference the Common SQL Errors documentation. This often means that you will need to enable full table scans by setting this run time parameter (odps.sql.allow.fullscan
) to true
%python# Create a MaxCompute (ODPS) entrance objecto = z.getDatasource("zepl_docs_alibaba_maxcompute")# Create data to write. Number of values per list must match the schema dtypes: o.get_table('sale_detail').schemarecords = [["Samsung", 1234, 1000.00, "2020-01-01", "USA"], ["Apple", 9876, 5000.00, "2020-01-01", "USA"]]# Write to table 'sale_detail', all records at a specific partition for sale_date and regiono.write_table('sale_detail', records, partition='sale_date="2020-01-01", region="USA', create_partition=True)
Generate User Access Key and Secret
Login to your Alibaba Cloud console
Navigate to Resource and Access Management (RAM)
Select User > Then you specific user
Select Create Access Key.
Download this file and enter the corresponding values in the Zepl Data Source. If you lose this file, you will need to generate new Access Keys for this user.