Develop a PyODPS script
PyODPS is the Python SDK for MaxCompute. It provides the DataFrame framework and basic operations on MaxCompute objects for data analysis and processing.
Prerequisites
You have configured a Python development environment. For more information, see Configure a Python development environment.
Procedure
-
In the Project section, right-click scripts and select .
-
In the Create new MaxCompute python class dialog box, enter a name in the Name field and select PyODPS Script from the Kind list.
-
After you create a MaxCompute PyODPS script, the template automatically initializes the
odpsandoobjects using a PyODPS room.When you develop a PyODPS script in DataWorks, the system automatically creates the room. When you use IntelliJ IDEA, you must create the room manually. For more information, see the PyODPS documentation.
# Initialize odps and o. DataWorks automatically initializes these objects using pyodpswrapper.py. from odps.inter import enter if 'o' not in globals(): room = enter() odps = o = room.odps # Initialization is complete. You can now write your PyODPS script. o.get_table('dual')