Migration from a platform to local PyODPS¶
If Python on MaxCompute (PyODPS) does not have the required packages or resources, and you need to debug PyODPS locally, then you need to migrate to a local PyODPS environment.
For more information about installing PyODPS, see Installation instruction. You need to use PyODPS to manually create the ODPS object. Use the following statement on PyODPS to generate the template that is required for creating the ODPS object, and then modify the template using the following code:
print("\nfrom odps import ODPS\no = ODPS(%r, '<access-key>', %r, '<endpoint>')\n" % (o.account.access_id, o.project))
In this code, replace <access-key> and <endpoint> with applicable values. To obtain AccessKeys, move the pointer to the user icon in the upper-right corner in the DataWorks console, and click the accesskeys icon in the displayed menu. To obtain endpoints, see MaxCompute activation and service connections by region , or contact the owner of your project.
Then, place the modified code to the top of all other code.