PyODPS provides methods to query and check the existence of MaxCompute projects. A project is the basic organizational unit of MaxCompute. For more information, see Project.
Prerequisites
Before you begin, ensure that you have set up a PyODPS runtime environment:
-
DataWorks: Create a PyODPS 2 node or a PyODPS 3 node. For more information, see Use PyODPS in DataWorks.
-
On-premises machine: Install PyODPS and initialize the MaxCompute entry object.
Get project information
Call get_project() on the MaxCompute entry object to retrieve a project. Pass a project name to get a specific project, or omit the argument to get the current project.
project = o.get_project('project_name') # Returns the specified project
project = o.get_project() # Returns the current project
Check if a project exists
Call exist_project() with the project name. The method returns True if the project exists.
print(o.exist_project('doc_test'))